4 ms·
I don't understand the parameter section. What fundamental mistake is python trying to remedy with the must-be-positional parameter? I don't get why you would
by wodenokoto 6y ago
I don't understand the parameter section. What fundamental mistake is python trying to remedy with the must-be-positional parameter?
I don't get why you would want to force people to not name a parameter.
Like, why is it so bad that I write:
myval = mydict.get(mykey, default=mydefault)
Who does it help that this throws an error?
- xrisk 6y agohttps://www.python.org/dev/peps/pep-0570/ https://www.python.org/dev/peps/pep-0570/
- makecheck 6y agoIn many languages you can do whatever you want with parameter names because they’re an implementation detail. In Python it’s always been frustrating that perhaps a less experienced developer can rename a parameter “inside the function” and break calling code that happened to refer to the name. (And since it isn’t static/compiled, how long after the change will you see this break?)