Re: cute use of lambda

2007-09-28 Thread Kay Schluehr
On 29 Sep., 03:55, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Simon Forman" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | class FakeQueue(list): > |put = list.append > |get = lambda self: self.pop(0) > > Sorry, to me this is a foolish use of lambda as it is exactly th

Re: cute use of lambda

2007-09-28 Thread Terry Reedy
"Simon Forman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | class FakeQueue(list): |put = list.append |get = lambda self: self.pop(0) Sorry, to me this is a foolish use of lambda as it is exactly the same as def get(self): self.pop(0) except that in the latter, the r

Re: cute use of lambda

2007-09-27 Thread Paul Rubin
Simon Forman <[EMAIL PROTECTED]> writes: > class FakeQueue(list): > put = list.append > get = lambda self: self.pop(0) from collections import deque class FakeQueue(deque): put = deque.append get = deque.popleft -- http://mail.python.org/mailman/listinfo/python-list

cute use of lambda

2007-09-27 Thread Simon Forman
class FakeQueue(list): put = list.append get = lambda self: self.pop(0) ;] -- http://mail.python.org/mailman/listinfo/python-list