May-29-2024, 05:35 PM
that's outside of foo(). what about inside? code foo() to print() the value it has (e.g. for a function to realize its own name). the purpose is so i can insert or import some code from another file or module that will learn the name of the function it was in the definition of.
Output:lt1a/forums/3 /home/forums 6> python3.8
Python 3.8.10 (default, Nov 22 2023, 10:22:35)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> def foo():
... print(__name__)
...
>>> bar = foo
>>> bar()
__main__
>>>
lt1a/forums/3 /home/forums 7>
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.