[Python-Dev] co_firstlineno on decorated functions (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Tue Aug 3 17:19:50 CEST 2010
- Previous message: [Python-Dev] co_firstlineno on decorated functions
- Next message: [Python-Dev] co_firstlineno on decorated functions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Le mardi 03 août 2010 à 11:05 -0400, Raghuram Devarakonda a écrit :
On Tue, Aug 3, 2010 at 10:14 AM, Guido van Rossum <guido at python.org> wrote:
> What are the use cases for cofirstlineno? Even if it is for > displaying the source code, I can find virtue for both sides of this > argument. nose uses cofirstlineno to determine order of the test functions and decorating a test function can change such order. To keep the ordering, it provides nose.tools.makedecorator() which explicitly keeps the line number of the original function. Check the following thread for a discussion in this regard:
That's pretty much orthogonal, though. We're talking about the case of a decorator which returns the original function object (and therefore doesn't change co_firstlineno).
Anyway, when co_firstlineno is used for ordering purposes, it doesn't matter whether some values are offset by one when a decorator is applied.
Regards
Antoine.
- Previous message: [Python-Dev] co_firstlineno on decorated functions
- Next message: [Python-Dev] co_firstlineno on decorated functions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]