Convert to binary and convert back to strings

Paul Rubin http
Sat Feb 24 04:33:14 EST 2007


"Hendrik van Rooyen" <mail at microcorp.co.za> writes:
> > s += chr(reduce(operator.xor, ar))
> Yikes! - someday soon I am going to read the docs on what reduce does...

Reduce just intersperses an operator over a sequence.  For example,
  reduce(operator.add, (a,b,c,d,e)) 
is a+b+c+d+e.  

> Won't this be slow because of the double function call on each char?

I think there's the same number of func calls, one xor per char.



More information about the Python-list mailing list