Anagrams

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sun Oct 28 23:10:30 EDT 2007


En Thu, 25 Oct 2007 00:40:12 -0300, sandipm <sandip.more at gmail.com>  
escribi�:

> thanks..I  am using python 2.4.4. so i couldnt find "all" either as
> inbuilt module
> or by doing "from itertools import *",  "all" is not available.
> I think I need to move to 2.5 then....

It's easy to write in pure Python:

def all(iterable):
     for item in iterable:
         if not item: return False
     return True

And its cousin, any:

def any(iterable):
     for item in iterable:
         if item: return True
     return False

> but what are the pros/cons of moving to 2.5? as we are using 2.4.4 on
> production server which is quite stable.
> any good pointers?

Pros: See the "What's new" document  
http://www.python.org/doc/2.5/whatsnew/whatsnew25.html

Cons: As always with any "dot" release, extension modules are incompatible  
and have to be recompiled. Even a year after the 2.5 release, you may have  
some problems finding precompiled binaries. Ensure that all your required  
libraries are available for 2.5

-- 
Gabriel Genellina




More information about the Python-list mailing list