ruby %w equivalent

hg hg at
Mon Sep 25 22:23:49 CEST 2006

hg wrote:
> MonkeeSage wrote:
>> hg wrote:
>>> Why would they want to make such an obscure API ? ... didn't they have
>>> Python to learn from (I am truly amazed - nothing cynical ...just ...
>>> why ?!!!!)
>> In ruby there are several special literal notations, just like python.
>> In ruby it goes like this:
>> %{blah} / %Q{blah} # same as "blah" but igornes " and '
>> %q{blah} # same as 'blah' but no interpolation
>> %w{blah blah} # same as "blah blah".split
>> %r{blah} # same as /blah/
>> %x{ls} # same as `ls`
>> Sometimes they are very useful, and sometimes they are cumbersome. It's
>> up to the programmer to implement them effectively.
>> Regards,
>> Jordan
> I am certain Ruby is a very effective language (I read much good stuff
> about it) ... it's just that I cannot comprehend why a "new" language
> would attempt so hard to look like assembly.
> Regards,
> hg
To further comment: back to the PDP11 and such guys, there was a true
need to "terse" the language and give the computer a break ... "what
I've already calculated, the computer needs not to calculate ... plus
I'm avoiding potential software(assembler/compiler) bugs"

But today ? what is the cost of replacing %w("blah blah") by
Hi_I_Want_To_Split_The_String_That_Follows( "blah blah")

More information about the Python-list mailing list