Who's minister of propaganda this week?

Darren New dnew at san.rr.com
Wed Mar 14 12:20:32 EST 2001


Phlip wrote:
> Ruby trumps Python in the simple matter of
> closures (imagine my shock when I discovered Python didn't have them). 

Can someone summarize the important difference between closures and object
instances? Other than convenience, I mean, it would seem that something like

class yadda:
  def __init__(self, a, b):
    self.a = a ; self.b = b
  def __call__(self, x, y):
    return (self.a + x * self.b * y)

would seem to be quite a lot like a closure with a and b bound and x and y
free?

(Pardon the python syntax errors.)

Now, coroutines, that's a bit different. :-)

-- 
Darren New / Senior MTS & Free Radical / Invisible Worlds Inc.
San Diego, CA, USA (PST).  Cryptokeys on demand.



More information about the Python-list mailing list