a Python person's experience with Ruby

Arkanes arkanes at gmail.com
Sat Dec 8 11:27:45 EST 2007


Colin J. Williams wrote:
> Steve Howell wrote:>
> Thanks for the interesting comparison.
>
> [snip]
>   
>>   3) I actually like being able to omit parentheses in
>> method definitions and method calls.  In Ruby you can
>> express "add(3,5,7)" as both "add(3,5,7)" and "add 3,
>> 5, 7."  The latter syntax is obviously more error
>> prone, but I don't think I've ever actually gotten bit
>> by it, and the code appears more clean to me.
>>
>>     
> [snip]
>
> I'm not sure that I like add 3, 5, 7
>
> but it would be nice to be able to drop 
> the parentheses
> when no argument is required.
>
> Thus:         close;
> could replace close();
>
>   

The fact that you can do this in Ruby and not in Python is why passing 
callables in Ruby is awkward and it's extremely natural in Python. In 
Ruby, of course, you don't pass callables around as much, using blocks 
instead, so it works out there. But it's an example of some of the 
fundamental syntax differences between the languages.



More information about the Python-list mailing list