[Tutor] More type() puzzlement
Alan Gauld
alan.gauld at btinternet.com
Sun Oct 28 09:53:53 CET 2007
"Dick Moores" <rdm at rcblue.com> wrote
> So you're saying that it's to be expected that the analogy, "int is
> to long as int is to float" will hold. But why should it be expected
> to hold? float and long are completely different animals, no?
No, they are all types of numbers.
The general rule is that Python (and most other languages)
will convert a simpler type to a more "powerful" type but never
the other way around - you may need to keep the power...
Alan G
More information about the Tutor
mailing list