[Python-Dev] #pragmas in Python source code

Peter Funk pf@artcom-gmbh.de
Wed, 12 Apr 2000 20:17:25 +0200 (MEST)


Hi!

[me:]
> > This would defeat an important goal: backward compatibility: You
> > can't add 'pragma division: old' or something like this to a source
> > file, which should be able to run with both Python 1.5.2 and Py3k.
> > This would make this mechanism useless for several important
> > applications of pragmas.
 
M.-A. Lemburg:
> Hmm, I don't get it: these pragmas would set variabels which
> make Python behave in a different way -- how do you plan to
> achieve backward compatibility here ?
> 
> I mean, u = u"abc" raises a SyntaxError in Python 1.5.2 too...

Okay.  What I mean is for example changing the behaviour of the
division operator:  if 1/2 becomes 0.5 instead of 0 in some future
version of Python, it is a must to be able to put in a pragma
with the meaning "use the old style division in this module"
into a source file without breaking the usability of this source
file on older versions of Python.

Regards, Peter
-- 
Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260
office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen)