If I understood correctly, it's better not to use an expression for a local variable that's already a global function in Python. So I believe this
list = [1,2,3]
is disrecommended in favor of
mylist = [1,2,3]
because list
is already a built-in object in Python and mylist
is not. However, I'm not always sure whether I should or should not use some expression (e.g. dir
, num
or cnt
). Is there any comprehensive overview of the strings I'd better avoid for naming local variables?
Basically, avoid all of these. All those are inside the __builtin__
module (builtins
in Python 3).
Source: The Python Standard Library » Built-in Functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With