Fun with numbers - dammit, but I want a cast!
Terry Reedy
tjreedy at udel.edu
Mon Aug 11 13:21:04 EDT 2003
"Graham Nicholls" <graham at rockcons.co.uk> wrote in message
news:3f3792f2$0$18258$afc38c87 at auth.uk.news.easynet.net...
> > 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.
TJR
More information about the Python-list
mailing list