-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Description
Feature or enhancement
Proposal:
Hi
Does the current version of Python throws any error if a person declares a VARIABLE with the name of an existing built-in function of Python? Can a person write:
print = 'I want to kill print right now'
without ANY warning ? Or it warns for print but fails for other functions (example "sorted" ) ?
What brought me here is that few days ago, I declared one LIST variable called "sorted" and forgot that this name is of an EXISTENT built in function of Python. IMHO a good language should throw a fatal error immediately like: "Existent built in functions can NOT be redeclared: 'sorted ' " - but Python did nothing... a complete silence.
Some days later, enough for me to forget about this variable, I tried do sort something,.... using sorted()... I confess that I am not proficient in Python so... I don't know many things and searched Internet for sorted with lambda.
RESULT: I lost time and got frustration to find out Why Python was telling me that List is not callable... this message made me focus in the LIST inside the function and not the sorted function that was overwritten by a lose permited renaming.
Do you fellows think it is correct for Python not complain about rewriting existing built in functions?
Will Python alert about it in a future, or am I just using an old version of Python :D ?
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response