Re: How can I format unicode strings?

2009-09-09 Thread Tim Northover
gentlestone 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

Re: Is reduce() foldl() or foldr()?

2009-06-07 Thread Tim Northover
Steven D'Aprano 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/pyth

Re: How to print lambda result ?

2009-01-20 Thread Tim Northover
alex23 writes: > On Jan 20, 10:34 pm, "Barak, Ron" 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 st