Rune Strand wrote: > Is it an idea to include a new __filename__ predefined attribute to > 2.5, so that __file__ contains the entire path to the module, and > __filename__ only the name of the module? > > For instance it's useful to include a not-static reference to the > filename in a scripts usage() section and it's cumbersome to extract > the filename or to do module imports just to parse it. > No. It's not usually a good idea to remove complexity from your program by adding it (where most of the time it's not needed) to the underlying system. Here's a clue as to how you might do without __file__ altogether:
[EMAIL PROTECTED] ~/Projects/Python $ cat test78.py import sys print sys.argv [EMAIL PROTECTED] ~/Projects/Python $ python test78.py can we say live with it? ['test78.py', 'can', 'we', 'say', 'live', 'with', 'it?'] regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list