New PEP: The directive statement

Carlos Ribeiro carribeiro at yahoo.com
Thu Mar 22 07:16:10 EST 2001


At 10:41 22/03/01 +0100, Martin von Loewis wrote:
> > My second comment is that you may want to consider adopting a form of the
> > __future__ proposal's runtime semantics for directive statements.  Perhaps
> >
> >     directive transitional.nested_scopes
> >
> > could create a "_Feature object" called nested_scopes identical to the one
> > proposed in "back to the __future__".
> >
> >     print nested_scopes.getOptionalRelease()   # prints "(2, 1, 0, 
> 'beta', 1)"
>
>I have my problems with that part of PEP 236 also. While it is
>certainly possible to provide the release when a feature was first
>released, it is not possible to give an accurate answer to the
>question when it will become mandatory. The intent to make it
>mandatory in the future should go into the documentation, IMO.
>
>Furthermore, what is the use of that information to a program?

That's indeed a good question. For a program it's not so good as runtime 
information. It *could* be potentially useful for the interpreter prompt 
though, as a form of 'introspection' - but is nothing that could not be 
done by means of documentation. One different way to do it it would be 
through a dictionary called __directive__, returning a data structure 
similar to the one proposed by the 'import __future__' PEP.

It *could* be useful also in another circumstance - what a directive is 
supposed to do in a multi-module program? Will we need to set a directive 
globally (for every module)? I'm not sure of the semantics in this case. 
The transitional.nested_scopes does not seem to pose many problems for this 
particular case, but I'm yet to see more development in this area.




_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com





More information about the Python-list mailing list