#ifdef like question.

Jeff Shannon jeff at ccvcorp.com
Tue May 14 13:56:47 EDT 2002


In article <mailman.1021387164.5783.python-list at python.org>, 
Roman Yakovenko says...

> Guys don't you think that we have some nice method to solve this problem?
> 
> The problem: writing code using new futures( like generators, ...)=20
> and code with the same functionality ( interface ) but using old =
> methods.

No, I don't think there's a need for a nicer way to write two 
sets of code with identical functionality.  Once you've written 
the old, backwards-compatible code, then (as Dave Brueck has 
already pointed out) where's the benefit in also writing the 
using-new-features code?  And if you cannot get the functionality 
you need without the new features, then trying to provide a 
partial, incompatible solution in a transparent way is a mistake.  
If it's not completely compatible, then you *want* to force it to 
be explicitly used.  If it *is* completely compatible, then 
writing old *and* new gains you nothing.  Therefore, you should 
just write old-style code if you need to support older Python 
versions, and you should require a new Python version if you must 
use new features.  This really is the only "nice method" to solve 
this.

-- 

Jeff Shannon
Technician/Programmer
Credit International



More information about the Python-list mailing list