Python Worst Practices
BartC
bc at freeuk.com
Sat Feb 28 05:39:55 EST 2015
On 28/02/2015 01:09, Steven D'Aprano wrote:
> Likewise:
>
> int = 23
> n = int("42")
>
> Isn't it obvious that the second use of int has to be the built-in function?
> I wish that the computer would understand from context which one I mean.
(People here would like PL/I then which apparently has *no* reserved
words, so you can write: "if if=then then ...")
> Other newbie stylistic mistakes which can increase the chance of shadowing
> errors include:
>
> * Too many overly generic variable names like "int" and "str".
One thing I find annoying when looking at tutorial examples of an
unfamiliar language is when they use identifier names such as
"function", "array", "integer", "var" and so on, names which could
conceivably be reserved words.
Because it's not clear if these *are* keywords that form part of the
syntax, or built-ins, or actual made-up user identifiers.
--
Bartc
More information about the Python-list
mailing list