[Python-Dev] Passing floats to file.seek

Steve Holden steve at holdenweb.com
Mon Nov 13 11:08:17 CET 2006

Guido van Rossum wrote:
> On 11/12/06, Anthony Baxter <anthony at interlink.com.au> wrote:
>> On Sunday 12 November 2006 22:09, Fredrik Lundh wrote:
>>> Martin v. Löwis wrote:
>>>> Patch #1067760 deals with passing of float values to file.seek;
>>>> the original version tries to fix the current implementation
>>>> by converting floats to long long, rather than plain C long
>>>> (thus supporting files larger than 2GiB).
>>>> b) if not, should Python 2.6 just deprecate such usage,
>>>>    or outright reject it?
>>> Python 2.5 silently accepts (and truncates) a float that's within range,
>>> so a warning sounds like the right thing to do for 2.6.  note that read
>> I agree that a warning seems best. If someone (for whatever reason) is
>> flinging floats around where they actually meant to have ints, going straight
>> to an error from silently truncating and accepting it seems a little bit
>> harsh.
> Right. There seem to be people who believe that 1e6 is an int.
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.

Next thing you know some damned fool is going to suggest that 1e6 gets 
parsed into a long integer.

There, I feel better now.

thank-you-for-listening-ly y'rs  - steve
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden

More information about the Python-Dev mailing list