Re: Self-identifying functions and macro-ish behavior

2006-02-15 Thread Duncan Booth
Michael wrote: def func2(): do some stuff 2 print self-name return True I imagine this means things like closures which I'm not familiar with (I'm not a CS person). In this case, each function is part of a class, so I imagine I can take a dir() of the class if necessary.

Re: Self-identifying functions and macro-ish behavior

2006-02-15 Thread Iain King
[EMAIL PROTECTED] wrote: Hi, I was wondering how I may get a python function to know what its name is without me having to write it manually? For example: def func1(): do some stuff1 print 'func1' return True def func2(): do some stuff2 print 'func2' return

Re: Self-identifying functions and macro-ish behavior

2006-02-15 Thread Ben Cartwright
[EMAIL PROTECTED] wrote: How do I get some sort of macro behavior so I don't have to write the same thing over and over again, but which is also not neatly rolled up into a function, such as combining the return statements with a printing of self-name? Decorators:

Self-identifying functions and macro-ish behavior

2006-02-14 Thread 63q2o4i02
Hi, I was wondering how I may get a python function to know what its name is without me having to write it manually? For example: def func1(): do some stuff1 print 'func1' return True def func2(): do some stuff2 print 'func2' return True should be more like def func1():