C macros in Python.

Grant Griffin g2 at seebelow.org
Fri Oct 13 13:45:11 EDT 2000


Steve Juranich wrote:
> 
> I was just wondering if there was anything available in Python like the
> __FILE__ and __LINE__ macros in C.  I know about the __name__ attribute, but
> I'm not sure that does exactly what I'm looking to do.
> 
> What I'd like to do is write some code that will tell me _exactly_ on which
> file and while line things went wrong.

On a different, but related, topic...I sometimes miss C's #define
macro.  There doesn't seem to be any similar thing in Python capable of
creating identifiers which are 1) constant, that is, "read only", and 2)
truly global in scope.

"Or-am-I-about-to-learn-a-new-wortish-Python-idiom?-asked-the
   -beamish-boy-in-uffish-thought-with-vorpal-blade-in-hand-ly y'rs,

=g2
-- 
_____________________________________________________________________

Grant R. Griffin                                       g2 at dspguru.com
Publisher of dspGuru                           http://www.dspguru.com
Iowegian International Corporation	      http://www.iowegian.com



More information about the Python-list mailing list