[I'm not a regular poster, so I'll introduce myself shortly: I am a first-year Physics student without CS knowledge, have learned programming with Python a few years ago] Gregory Smith wrote: > > At the time the TypeError is constructed it shouldn't add serious > > overhead to check if its a method or a function and subtract 1 > > accordingly. Guido van Rossum replied: > You'd think so, eh? Have you looked at the code? Have you tried to > come up with a patch? Why do you think that in 13 years this hasn't > been fixed if it's such a common complaint? Would it be possible to have this code at IDE-level? E.g., is possible for Idle to catch TypeError's and try to find out whether this is about the number of arguments to a callable, and if so, try to find out whether it is about a method or a function? This is of course a lot of overhead, but since it is only for an interactive session, I think this is not a big problem, or am I mistaken here? Something like: except TypeError, msg: if "takes exactly" in msg[0]: # something with tb_lasti? name = msg[0].split('(')[0] typ, val, tb = sys.exc_info() if name in tb.tb_frame.f_locals.keys(): if 'instancemethod' in type(tb.tb_frame.f_locals[name]): # subtract 1 else: # don't subtract 1 else: # hmm, if it is a method, how do we find it? # etc. else: raise It seems quite difficult to do so. It is certainly not always possible, but is it worth the pain? regards, Gerrit Holl. -- 201. If he knock out the teeth of a freed man, he shall pay one-third of a gold mina. -- 1780 BC, Hammurabi, Code of Law -- Asperger Syndroom - een persoonlijke benadering: http://people.nl.linux.org/~gerrit/ Kom in verzet tegen dit kabinet: http://www.sp.nl/
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