Re: Python equivt of __FILE__ and __LINE__

2008-02-14 Thread alain
On Feb 14, 1:50 am, Gabriel Genellina [EMAIL PROTECTED] wrote: En Wed, 13 Feb 2008 13:07:31 -0200, alain [EMAIL PROTECTED] escribió: There exists an undocumented builtin called __file__, but unfortunately no corresponding __line__ There is no __file__ builtin AFAIK; but there is __file__

Re: Python equivt of __FILE__ and __LINE__

2008-02-13 Thread alain
On Feb 12, 7:44 pm, Jeff Schwab [EMAIL PROTECTED] wrote: It still would be nice to have syntax as clean as __FILE__ and __LINE__. There exists an undocumented builtin called __file__, but unfortunately no corresponding __line__ Alain -- http://mail.python.org/mailman/listinfo/python-list

Re: Python equivt of __FILE__ and __LINE__

2008-02-13 Thread Jeff Schwab
alain wrote: On Feb 12, 7:44 pm, Jeff Schwab [EMAIL PROTECTED] wrote: It still would be nice to have syntax as clean as __FILE__ and __LINE__. There exists an undocumented builtin called __file__, but unfortunately no corresponding __line__ Drat! So close! Thanks for the info. Oh well,

Re: Python equivt of __FILE__ and __LINE__

2008-02-13 Thread Gabriel Genellina
En Wed, 13 Feb 2008 13:07:31 -0200, alain [EMAIL PROTECTED] escribió: There exists an undocumented builtin called __file__, but unfortunately no corresponding __line__ There is no __file__ builtin AFAIK; but there is __file__ module attribute documented here:

Re: Python equivt of __FILE__ and __LINE__

2008-02-12 Thread alain
On Feb 11, 10:58 am, Bill Davy [EMAIL PROTECTED] wrote: Writing a quick and dirty assembler and want to give the user the location of an error.  The assembly language is Python.  If the user wants to generat some object code they write something  like: Label(LoopLable)     Load(R4)    

Re: Python equivt of __FILE__ and __LINE__

2008-02-12 Thread Jeff Schwab
Gabriel Genellina wrote: En Tue, 12 Feb 2008 14:41:20 -0200, Jeff Schwab [EMAIL PROTECTED] escribi�: def line(): try: raise Exception except: return sys.exc_info()[2].tb_frame.f_back.f_lineno def file():

Re: Python equivt of __FILE__ and __LINE__

2008-02-12 Thread Jeff Schwab
Gabriel Genellina wrote: En Tue, 12 Feb 2008 16:20:12 -0200, Jeff Schwab [EMAIL PROTECTED] escribió: What about the following? Should the underscores be omitted from the method names, for consistency with inspect? I prefer the names_with_underscore, the current style recommended by

Re: Python equivt of __FILE__ and __LINE__

2008-02-12 Thread Gabriel Genellina
En Tue, 12 Feb 2008 16:20:12 -0200, Jeff Schwab [EMAIL PROTECTED] escribió: What about the following? Should the underscores be omitted from the method names, for consistency with inspect? I prefer the names_with_underscore, the current style recommended by PEP8

Re: Python equivt of __FILE__ and __LINE__

2008-02-12 Thread Steve Holden
Bill Davy wrote: [...] What a lovely langauge. +1 QOTW -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python equivt of __FILE__ and __LINE__

2008-02-12 Thread Gabriel Genellina
En Tue, 12 Feb 2008 14:41:20 -0200, Jeff Schwab [EMAIL PROTECTED] escribi�: def line(): try: raise Exception except: return sys.exc_info()[2].tb_frame.f_back.f_lineno def file(): return

Re: Python equivt of __FILE__ and __LINE__

2008-02-12 Thread Jeff Schwab
alain wrote: On Feb 11, 10:58 am, Bill Davy [EMAIL PROTECTED] wrote: Writing a quick and dirty assembler and want to give the user the location of an error. The assembly language is Python. If the user wants to generat some object code they write something like: Label(LoopLable)

Re: Python equivt of __FILE__ and __LINE__

2008-02-12 Thread Bill Davy
thebjorn [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Feb 11, 4:55 pm, Gary Herron [EMAIL PROTECTED] wrote: Bill Davy wrote: Writing a quick and dirty assembler and want to give the user the location of an error. The assembly language is Python. If the user wants to

Re: Python equivt of __FILE__ and __LINE__

2008-02-11 Thread thebjorn
On Feb 11, 4:55 pm, Gary Herron [EMAIL PROTECTED] wrote: Bill Davy wrote: Writing a quick and dirty assembler and want to give the user the location of an error. The assembly language is Python. If the user wants to generat some object code they write something like: Label(LoopLable)

Re: Python equivt of __FILE__ and __LINE__

2008-02-11 Thread Gary Herron
Bill Davy wrote: Writing a quick and dirty assembler and want to give the user the location of an error. The assembly language is Python. If the user wants to generat some object code they write something like: Label(LoopLable) Load(R4) Dec() JNZ(LoopLabel) I can use

Python equivt of __FILE__ and __LINE__

2008-02-11 Thread Bill Davy
Writing a quick and dirty assembler and want to give the user the location of an error. The assembly language is Python. If the user wants to generat some object code they write something like: Label(LoopLable) Load(R4) Dec() JNZ(LoopLabel) I can use Python to do all the