Re: How can I format unicode strings?
gentlestone tibor.b...@hotmail.com writes: return u{}.format(self.name) this one doesn't work on unicode strings. I there a not old formatting style possibilty for unicode strings? It looks like you're trying to mix python 3.1 and 2.6. In 2.6 you have to put a number inside the {} to tell it which argument to use. In 3.1 all strings are unicode. Apparently when 2.7 is released it will backport the empty {} feature from 3.1. Until then return u'{0}'.format(self.name) is what you should probably use. Tim. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is reduce() foldl() or foldr()?
Steven D'Aprano st...@remove-this-cybersource.com.au writes: Calling all functional programming fans... is Python's built-in reduce() a left-fold or a right-fold? I get: reduce(lambda a, b: a/b, [1.0, 2.0, 3.0]) 0.1 which looks like a left fold to me. Tim. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to print lambda result ?
alex23 wuwe...@gmail.com writes: On Jan 20, 10:34 pm, Barak, Ron ron.ba...@lsi.com wrote: for num in range(1, 4): ... string_ = %d event%s % (num, (lambda num: num 1 and s or )(num)) ... print string_ The notation here suggests Ron is sligtly confused about what he created. It was equivalent to string_ = %d event%s % (num, lambda x: x 1 and s or ) Notice that there's no actual mention of num there, it's a function that takes one parameter. If that parameter happens to be num it does what you want, but there's no way for the interpreter to know what was intended. Tim. -- http://mail.python.org/mailman/listinfo/python-list