by simon baird

Tuesday, May 13, 2008

python bitching

>>> x = [                           
... "foo",                          
... "bar" # oops missing comma      
... "etc"                           
... ]                               
>>> x                               
['foo', 'baretc']
>>>
eh? wt..?

python, you owe me an hour of my life, which is about how long it took me to find this 'bug', if you could call it that. I'd call it a syntax error. one hour!! a syntax error!!! GAHHHH.. :P

watch and learn:
irb(main):001:0> x = [                                              
irb(main):002:1* "foo",                                             
irb(main):003:1* "bar"                                              
irb(main):004:1> "etc"                                              
irb(main):005:1> ]                                                  
SyntaxError: compile error                                          
(irb):4: syntax error, unexpected tSTRING_BEG, expecting ']'        
"etc"                                                               
 ^                                                                  
(irb):5: syntax error, unexpected ']', expecting $end               
        from (irb):5                                                
irb(main):006:0>                                                    
ah, sanity returns

1 comment:

Deuce said...

python is nice to programmers, and tries to help them by concatenating adjacent strings into one big string.

ruby *loves* programmers, and helps you by not surprising you like that.

here's hoping google add ruby to the AppEngine stable soon..