Comment on Ruby's not readyparentComments−tptacek18yOf course there is: if you couldn't access variables in the enclosing scopes, blocks would be drastically less useful. Ruby uses anonymous functions where Python would use a loop construct.−akkartik18y[We took this conversation offline. it seems this is a known gotcha (e.g. http://www.osix.net/modules/article/?id=401), and may be changed in ruby 2.0 (http://groups.google.com/group/sbonrails/browse_thread/threa...). Thanks tptacek.]
Comments
Of course there is: if you couldn't access variables in the enclosing scopes, blocks would be drastically less useful. Ruby uses anonymous functions where Python would use a loop construct.
[We took this conversation offline. it seems this is a known gotcha (e.g. http://www.osix.net/modules/article/?id=401), and may be changed in ruby 2.0 (http://groups.google.com/group/sbonrails/browse_thread/threa...). Thanks tptacek.]