Heiko Wundram wrote: > Paul Rubin wrote: > >>def perm(n): >> return [tuple([(1,-1)[(t>>i)%2] for i in xrange(n)]) >> for t in xrange(2L**n)] > > > or replace that with: > > def perm(n): > return (tuple(((1,-1)[(t>>i)%2] for i in xrange(n))) > for t in xrange(2L**n)) > > to get a generator like in Paul's first example. Only works with Python 2.4+ > though. > > --- Heiko.
Isn't this kind of coding beeing the result of suffering from the post-pyContest illness syndrom? Or is there another reason behind writing it that way sacrificing readability like usage of less CPU time to run the code? Or am I alone having trouble to read this kind of code because not experienced enough in writing Python scripts? Claudio -- http://mail.python.org/mailman/listinfo/python-list