News for hackers. Stuff that matters.
Re:How is Ruby different in Japan? by brazzledazzle on Monday June 19, 2017 @01:21AM (#14584755)
It's one small thing but string interpolation annoys the crap out of me when using Python and while it might tick the understandable check box I wouldn't say it's easier to read. After using Ruby it's such a chore to read or write in my opinion (which admittedly doesn't mean much having so little experience with Python).
Re:How is Ruby different in Japan? by cutler on Monday June 19, 2017 @07:05AM (#14585977)
How is "#{fname} #{surname}" better than f'{fname} {surname}' ?
Re:How is Ruby different in Japan? by klibertp on Monday June 19, 2017 @10:44AM (#14587339)
OTOH, f-strings were added to Python not long ago, and they are the third or fourth (depending on if you count `string.Template`) syntax for string interpolation in Python. Frankly, string formatting in Python is a bit of a mess right now.
Re:How is Ruby different in Japan? by iipin on Monday June 19, 2017 @10:37AM (#14587279)
By the glare of it, none. But you have to understand that ruby has that `#{}` since ways before, and python has just added that `f` syntax recently. Also in ruby it's the only way of doing string interpolation, while in python you have % and other methods.
Re:How is Ruby different in Japan? by herbst on Monday June 19, 2017 @11:26AM (#14587638)
Ruby does have % too for quite a while. As in

    '%s won $%i' % ['herbst', 5000]
Re:How is Ruby different in Japan? by int_19h on Monday June 19, 2017 @07:42PM (#14591228)
You actually want both of these. The reason why explicitly indexed placeholder syntax is still important, even if you have interpolation, is because the order in which the arguments are referenced may change when the string is localized.