New PEP: The directive statement

Martin von Loewis loewis at informatik.hu-berlin.de
Fri Mar 23 03:14:24 EST 2001


Bruce Sass <bsass at freenet.edmonton.ab.ca> writes:

> For example, I'd rather do...
> 
> use:
>     new_math.//
>     result = new_math_based_function()
> except NewMathError:
>     result = old_math_based_function()
> 
> ...and have the compiler use the appropriate source depending on what
> the interpreter can handle, rather than do a check of the
> "sys.version"[1] or try to catch a run-time exception.

And you would supply both new_math_based_function and
old_math_based_function in the same module, outside of the use: block?
That is probably difficult to implement, as the compiler *when
processing new_math_based_function* needs to know what / means.

Regards,
Martin



More information about the Python-list mailing list