newbie question - identifying name of method
mirandacascade at yahoo.com
mirandacascade at yahoo.com
Mon Feb 14 10:52:23 EST 2005
Does Python provide some sort of mechanism for answering the question:
what method am I in?
Example: assume the file example1.py contains the following code:
def driver():
print 'hello world'
print __name__
print 'the name of this method is %s' % str(???)
The output I'd like to see is:
hello world
example1
driver
and I'd like to be able to see it without hardcoding the string
'driver' in the third print statement. Is there anything I can
substitute for the ??? that answers the question: what method am I in?
More information about the Python-list
mailing list