Writing backwards compatible code

Robert Kern robert.kern at gmail.com
Fri Apr 14 14:37:41 EDT 2006


Felipe Almeida Lessa wrote:
> Em Sex, 2006-04-14 às 13:28 -0500, Robert Kern escreveu:
> 
>>Steven D'Aprano wrote:
>>
>>>I came across an interesting (as in the Chinese curse) problem today. I
>>>had to modify a piece of code using generator expressions written with
>>>Python 2.4 in mind to run under version 2.3, but I wanted the code to
>>>continue to use the generator expression if possible.
>>
>>Why? AFAICT, it really is just syntactic sugar. Very nice syntactic sugar, but
>>not necessary at all. If you are going to have the ugly, syntactically bitter
>>version in your code anyways, why clutter up your code even more trying to do both?
> 
> Right. You can always use classes.

Well, I guess you could, but using actual generators would be much cleaner.

-- 
Robert Kern
robert.kern at gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list