Re: getting the current function

2007-09-10 Thread Jonathan Gardner
On Sep 7, 9:19 am, Gary Robinson <[EMAIL PROTECTED]> wrote: > > This all seems a bit too complicated. Are you sure you want to do > > this? Maybe you need to step back and rethink your problem. > > In version 2.1 Python added the ability to add function attributes -- > seehttp://www.python.org/dev

re: getting the current function

2007-09-09 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Gary Robinson wrote: > I've just never liked the fact that you have to name the function when > accessing those attributes from within the function. If it's any consolation, it's not actually the function name you need to refer to, merely any variable or Python obj

Re: getting the current function

2007-09-07 Thread Arnaud Delobelle
On Sep 7, 5:19 pm, Gary Robinson <[EMAIL PROTECTED]> wrote: > > This all seems a bit too complicated. Are you sure you want to do > > this? Maybe you need to step back and rethink your problem. > > In version 2.1 Python added the ability to add function attributes -- > seehttp://www.python.org/dev

re: getting the current function

2007-09-07 Thread Gary Robinson
> This all seems a bit too complicated. Are you sure you want to do > this? Maybe you need to step back and rethink your problem. In version 2.1 Python added the ability to add function attributes -- see http://www.python.org/dev/peps/pep-0232/ for the justifications. A counter probably isn't on

Re: getting the current function

2007-09-06 Thread Jonathan Gardner
On Sep 6, 8:43 am, Gary Robinson <[EMAIL PROTECTED]> wrote: > > I welcome feedback of any type. > This all seems a bit too complicated. Are you sure you want to do this? Maybe you need to step back and rethink your problem. Your example can be rewritten a number of different ways that are easier

getting the current function

2007-09-06 Thread Gary Robinson
Alex Martelli has a cookbook recipe, whoami, for retrieving the name of the current function: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062. It uses sys._getframe(). I'm a little wary about using sys._getframe() because of the underscore prefix and the fact that the python docs