New to Python: my impression v. Perl/Ruby

Serge Orlov sombDELETE at pobox.ru
Tue Jan 20 16:44:02 EST 2004


"Ville Vainio" <ville.spamstermeister.vainio at thisisspamprotectiontut.finland> wrote in message
news:du71xpue3rm.fsf at mozart.cc.tut.fi...
> >>>>> "Phil" == Phil Tomson <ptkwt at aracnet.com> writes:
>
>     Phil> Different strokes for different folks, I guess.  I remember
>     Phil> that one of the first things I saw about Ruby was that even
>     Phil> interger literals were objects that can receive messages and
>     Phil> thinking how wonderful that was.  As you say, you're not
>
> Ints are objects in python too:
>
> >>> a=1
> >>> a.__lshift__(1)
> 2
>
> Though "sending messages" to int literals is a syntax error.

Try this:
>>> (1).__lshift__(1)
2

-- Serge.





More information about the Python-list mailing list