Guido van Rossum strung bits together to say: > For better or for worse, the distinction between a function and a > bound method is gone by the time it's called, and recovering that > difference is going to be tough. Not in terms of serious overhead, > but in terms of serious changes to code that is already extremely > subtle. That code it's so subtle *because* we want to keep function > call overhead as low as possible, and anything that would add even a > fraction of a microsecond to the cost of calling a function with the > correct number of arguments will be scrutinized to death. Given this, perhaps a simple addition to the error string might be enough to help reduce confusion: ------------- TypeError: foo() takes exactly 1 argument (2 given). (Note: For bound methods, the argument count includes the object the method is bound to) ------------- Experienced users are unlikely to care, and newer users should then be able to figure out why the argument count is one more than they expect. About the only problem I can see is that it is hard to be clear, without also making the error string rather long (like the one above). Regards, Nick. It's simple, but if it works. . . -- Nick Coghlan | Brisbane, Australia ICQ#: 68854767 | ncoghlan at email.com Mobile: 0409 573 268 | http://www.talkinboutstuff.net "Let go your prejudices, lest they limit your thoughts and actions."
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4