Fun with numbers - dammit, but I want a cast!

Terry Reedy tjreedy at
Mon Aug 11 19:21:04 CEST 2003

"Graham Nicholls" <graham at> wrote in message
news:3f3792f2$0$18258$afc38c87 at

> > Have you tried doing it this way:
> > xscale = xframe / float(img_x)
> Thats what I wanted to do, but was sure
>  I'd read that python didn't have casts,

Correct. Aside from re-classing of user-class instances, Python
objects are more strongly typed than C values.

> and that _looks_ like a cast to me!

No, quite different.  A C cast (at least usually) recasts a block of
bits in a new role without changing the bits.  Type constructors
(unless redundant as in int(1)) return a different object with a
different set of bits.


More information about the Python-list mailing list