Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 a module discovering its own name
#1
in a module that could be renamed when installed, is there a way for it to discover its own name at the time it is imported?
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Quote
#2
myname = __file__
Quote
#3
__name__
Quote
#4
yay! they both work.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Quote
#5
__name__ is better, __file__ doesn't work in interactive mode because there is no file
Skaperen likes this post
Quote

Top Page

Forum Jump:


Users browsing this thread: 1 Guest(s)