Le Tue, 7 May 2013 08:44:46 -0700,
Eli Bendersky <eli...@gmail.com> a écrit :
> >  > 4) Using _getframe(N) here seems like an overkill to me.
> >
> > It's not just overkill, it's fragile - it only works if you call the
> > constructor directly. If you use a convenience function in a utility
> > module, it will try to load your pickles from there rather than
> > wherever you bound the name.
> 
> In theory you can climb the frame stack until the desired place, but
> this is specifically what my proposal of adding a function tries to
> avoid.

I don't know how you could do it without walking the frame stack.
Granted, you don't need all the information that the stack holds
(you don't need to know about line numbers, instruction numbers
and local variables, for instance :-)), but you still have to walk
*some* kind of dynamically-created stack. This isn't something
that is solvable statically (as opposed to e.g. a class's __qualname__,
which is computed at compile-time).

Regards

Antoine.


_______________________________________________
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

Reply via email to