On Tue, Aug 3, 2010 at 6:05 AM, Nick Coghlan <ncogh...@gmail.com> wrote: > On Tue, Aug 3, 2010 at 10:48 PM, Antoine Pitrou <solip...@pitrou.net> wrote: >> Furthermore, co_firstlineno is an attribute of the code object, not the >> function object, so it shouldn't ideally depend on whether a decorator >> was applied or not. > > You cut the part about the inspect module (and no doubt other code) > relying on the current meaning, though. While I'd agree with you for a > clean slate definition, that's not what we're dealing with here: > "co_firstlineno" has an existing meaning, and it *isn't* "the line > containing the def keyword", it's "the first line of the function, > including any decorator lines". The decision could (and arguably > should) have gone the other way when decorator syntax was first added, > but changing our minds now would be making the situation worse rather > than better.
What are the use cases for co_firstlineno? Even if it is for displaying the source code, I can find virtue for both sides of this argument. -- --Guido van Rossum (python.org/~guido) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com