dynamic type variable

Grant Edwards grante at visi.com
Mon Jan 21 17:07:55 CET 2008


On 2008-01-21, J. Peng <jpeng at block.duxieweb.com> wrote:

> Python's variable is dynamic type,is it?
> But why this can't work?
>
>>>> 3 + 'a'

It can't work because the compiler has no way of knowing
whether the correct answer is '3a', 0x0d, the color purple, or
to reboot.

> So I see the number 3 can't be converted to string type automacially.

Because I wanted the string 'a' to be converted to an integer
automatically.

-- 
Grant Edwards                   grante             Yow! A can of ASPARAGUS,
                                  at               73 pigeons, some LIVE ammo,
                               visi.com            and a FROZEN DAQUIRI!!



More information about the Python-list mailing list