3 ms·
As a Rubyist who only uses Python casually, it's neat to learn this difference! You can write very similar code in Ruby but such default objects appear to be cr
by petercooper 5y ago
As a Rubyist who only uses Python casually, it's neat to learn this difference! You can write very similar code in Ruby but such default objects appear to be created fresh on initialization avoiding the problem.
- dragonwriter 5y agoOTOH, Ruby has a very similar footgun with mutable defaults, just with default values of Hashes, not default method arguments.