[Python-Dev] Passing floats to file.seek
murman at gmail.com
Mon Nov 13 15:23:43 CET 2006
On 11/13/06, Steve Holden <steve at holdenweb.com> wrote:
> In which case an immediate transition to error status would seem to
> offer a way of providing an effective education. Deprecation may well be
> the best way to go for customer-friendliness, but anyone who believes
> 1e6 is an int should be hit with a stick.
Right, but what about those people who just didn't examine it? I
consider myself a pretty good programmer, and was surprised by Guido's
remark. A little quick self-education later, I understood.
Still I find the implication that anyone using 1e6 for an integer
should be (have all their users) beaten absurd in the context of
backwards compatibility. Especially when they were using one of the
less apparent floats in a place that accepted floats. Perhaps it would
be a fine change for py3k.
> Next thing you know some damned fool is going to suggest that 1e6 gets
> parsed into a long integer.
I can guess why it isn't, but it seems more a matter of ease than a
matter of doing what's right. I had expected it to be an int because I
thought of 1e6 as a shorthand for (1 * 10 ** 6), which is an int. 1e-6
would be (1 * 10 ** -6) which is a float. 1.0e6 would be (1.0 * 10 **
6) which would also be a float. Clearly instead the e wins out as the
I'm not going to argue for it to be turned into an int, or even
suggest it, after all compatibility with obscure realities of C is
important. I'm just going to say that it makes more sense to me than
your reaction indicates.
Michael Urman http://www.tortall.net/mu/blog
More information about the Python-Dev