3 ms·
but ruby, python etc.. can just extract the list too, it's just an extra method call on the same object (perhaps there could be destructuring too in modern ruby
by riffraff 3y ago
but ruby, python etc.. can just extract the list too, it's just an extra method call on the same object (perhaps there could be destructuring too in modern ruby/python)
hour, min, sec = /(\d\d):(\d\d):(\d\d)/.match('10:11:12').captures
or
hour, min, sec = re.compile(r'(\d\d):(\d\d):(\d\d)').match('10:11:12').groups()
ruby & python will explode if there is no match rather than fail silently but I'm not convinced the difference is huge.