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

Graham Nicholls graham at
Mon Aug 11 14:58:26 CEST 2003

Charl P. Botha wrote:

> In article <3f378fac$0$10778$afc38c87 at>,
> Graham Nicholls wrote:
>> then I'm trying to  use those sizes to scale the image, but because
>> python has decided that they are integers, I keep getting division by
>> zero errors
>> eg
>>         xscale=xframe/img_x
>> where xframe will be say 300, and img_x will be 1800
>> xscale has the value 0.
> 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, and that _looks_ like a cast to me!


Graham Nicholls
Rock Computer Consultancy

More information about the Python-list mailing list