Skip to content

Instantly share code, notes, and snippets.

@dcarley
Created November 14, 2011 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcarley/1363673 to your computer and use it in GitHub Desktop.
Save dcarley/1363673 to your computer and use it in GitHub Desktop.
Ruby silently unpacks vars to nil, then interpolates to "".
dan@dan-MacPro:~$ python unpack.py
foo: foo
bar: bar
dan@dan-MacPro:~$ ruby unpack.rb
foo: foo
bar:
try:
foo, bar = ["foo"]
except:
foo, bar = ["foo", "bar"]
print "foo: %s" % foo
print "bar: %s" % bar
begin
foo, bar = ["foo"]
rescue
foo, bar = ["foo", "bar"]
end
puts "foo: #{foo}"
puts "bar: #{bar}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment