Claudio Grondi wrote:
> Heiko Wundram wrote:
>> def perm(n):
>>    return (tuple(((1,-1)[(t>>i)%2] for i in xrange(n)))
>>            for t in xrange(2L**n))
> 
> Isn't this kind of coding beeing the result of suffering from the
> post-pyContest illness syndrom?

I don't think what Paul Rubin posted is the sign of pyContest illness, as I
use two-level generator expressions such as this quite often in my code.
Why I didn't give this as the reponse to the OP was because it seems that
he's not that familiar with Python to be able to read this efficiently and
grap the concept behind the implementation immediately, that's why I
thought an explicit loop was in order.

But for any sufficiently advanced Python coder, I don't think this is
unreadable in the least.

--- Heiko.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to