New PEP: The directive statement

Joshua Macy amused at webamused.com
Sat Mar 24 09:25:04 EST 2001


Martin von Loewis wrote:

> 
> That is absolutely clear. I was asking you to predict the future: Do
> you think that people will prefer to write
> 
>   if __future__.nested_scopes.getOptionalRelease() >= sys.version_info:
> 
> instead of
> 
>   if sys.version_info < (2,1):
> 

  I certainly would, since the former communicates what's going on much
more clearly.  It spells out exactly why the optional release is
necessary for the code, while hiding the gory details of which optional
release is predicted to be the one satisfying it. In addition the same
__future__ approach would work for mandatory releases even if the final
version number where the feature really became mandatory changed,
whereas your version would require changing the magic number by hand in
every file if a mandatory release ever got bumped back--including in
files that I didn't write.  Even if all I checked the mandatory release
number for was emitting a warning to remove the from __future__, I don't
want to deal with a bunch of false positives.

  Clearer, more bulletproof code, yeah, I'd go for that.

  Joshua



More information about the Python-list mailing list