Is it bad practice to have a variable that has the same name as a function?
My answer to Is it bad practice to have a variable that has the same name as a function? on Quora
Yes, it’s definitely not a good idea. In Python functions and variables share the same namespace, so if you create a variable with the same name as a function you won’t be able to call that function.
(I admit I do break this rule occasionally when the variable scope is short enough that I’m certain it won’t cause any problems... but I shouldn’t. Do what I say, not what I do!)
More recent articles
- Understanding GPT tokenizers - 8th June 2023
- Weeknotes: Parquet in Datasette Lite, various talks, more LLM hacking - 4th June 2023
- It's infuriatingly hard to understand how closed models train on their input - 4th June 2023
- ChatGPT should include inline tips - 30th May 2023
- Lawyer cites fake cases invented by ChatGPT, judge is not amused - 27th May 2023
- llm, ttok and strip-tags - CLI tools for working with ChatGPT and other LLMs - 18th May 2023
- Delimiters won't save you from prompt injection - 11th May 2023
- Weeknotes: sqlite-utils 3.31, download-esm, Python in a sandbox - 10th May 2023
- Leaked Google document: "We Have No Moat, And Neither Does OpenAI" - 4th May 2023
- Midjourney 5.1 - 4th May 2023