Re:"I couldn't really learn Erlang, 'cos it didn't exist, so...
by btilly on Thursday January 24, 2013 @10:35AM
(#5110016)
To my eyes they always were true and complete, but you had to play the minor trick of using mutable data to get them. Here is an example of what I mean that has worked forever.
def outer ():
counter = [0]
def inner ():
counter[0] += 1
return counter[0]
return inner
Re:"I couldn't really learn Erlang, 'cos it didn't exist, so...
by klibertp on Thursday January 24, 2013 @10:49AM
(#5110098)
I think I heard that this wasn't working around 2.0 or earlier... but I'm not curious enough to go research and I wasn't using Python until 2.4. Can you maybe confirm or deny this?
Re:"I couldn't really learn Erlang, 'cos it didn't exist, so...
by btilly on Thursday January 24, 2013 @12:19PM
(#5110712)
I've never heard that. I also did not use Python until 2.4.
Re:"I couldn't really learn Erlang, 'cos it didn't exist, so...
by klibertp on Thursday January 24, 2013 @10:26AM
(#5109971)
In short, in your opinion, Python has no "complete" closures because you cannot bind a new value to the name from enclosing lexical scope from within a nested scope. I disagree.
Re:"I couldn't really learn Erlang, 'cos it didn't exist, so...
by effn on Thursday January 24, 2013 @11:26AM
(#5110324)
This is not possible in Haskell either. You never hear people claiming Haskell doesn't support closures.
Re:"I couldn't really learn Erlang, 'cos it didn't exist, so...
by klibertp on Thursday January 24, 2013 @11:42AM
(#5110443)
Which is why I disagree with claims that Python doesn't support them either. It does, of course; we could argue if Python supports "complete" closures, but we won't, because we know better than to use meaningless terms in discussion, right?
Re:"I couldn't really learn Erlang, 'cos it didn't exist, so...
by koide on Thursday January 24, 2013 @12:12PM
(#5110667)
In any case it's not been the case in a while, so I stand corrected.
Although being able to write on the closed over variable is a neat feature to have, I would argue that feature does make a difference. Whether you call that complete or read-write or however you want to.
Please correct me if I'm mistaken. This all comes from a cursory research on the subject.