Ruby Impressions

Paul Boddie paul at boddie.net
Thu Jan 10 12:47:48 CET 2002


gandy at techie.com (Thomas Gandy) wrote in message news:<752891fc.0201091327.5842485f at posting.google.com>...
>

[Ruby compared to Python]

>                   As I'm glancing through code I (and it's my opinion)
> must say it's easier to see the '@''s than the 'self's (and there's a
> bit less typing to do).

[...]

> In Python we do:
> 
> class SomeClass:
>    def __init__(self,value):
>       self.data = value
> 
> In Ruby you do:
> 
> class SomeClass
>    def initialize(value)
>       @data = value
>    end
> end

Although I would probably get used to it eventually, the use of
"initialize" rather than "__init__" seems to demand more effort (if
not really any more typing), especially for those of us who don't have
US English as our first language. ;-)

Paul



More information about the Python-list mailing list