J
John Ladasky
Hi, folks,
Here's a minimal Python 3.3.2 code example, and its output:
=================================================
def foo():
pass
print(foo)
bar = foo
print(bar)
=================================================
<function foo at 0x7fe06e690c20>
<function foo at 0x7fe06e690c20>
=================================================
Obviously, Python knows that in my source code, the name that was bound to the function I defined was "foo". The print function even returns me the name "foo" when I bind a new name, "bar", to the same function. This is useful information that I would like to obtain directly, rather than having to extract it from the output of the print statement. How can I do this? Thanks.
Here's a minimal Python 3.3.2 code example, and its output:
=================================================
def foo():
pass
print(foo)
bar = foo
print(bar)
=================================================
<function foo at 0x7fe06e690c20>
<function foo at 0x7fe06e690c20>
=================================================
Obviously, Python knows that in my source code, the name that was bound to the function I defined was "foo". The print function even returns me the name "foo" when I bind a new name, "bar", to the same function. This is useful information that I would like to obtain directly, rather than having to extract it from the output of the print statement. How can I do this? Thanks.