adalke at mindspring.com
Thu Sep 23 16:14:46 EDT 2004
Peter Hansen wrote:
> Wouldn't doing type(fd.tell()) be better than coupling
> the logic to what might be a changing representation of
> the data?
I suggested using repr instead of str because that
would make the smallest impact on the OP's code.
Using type(fd.tell()) == long) or rather
isinstance(fd.tell(), long) would be better,
but I can see a few possible problems.
- What does tell() return on a 64 bit
machine? A Python integer or long?
- When unification is finished, will it be
that isinstance(0, long) and/or
isinstance(2**35, int) (on a 32 bit machine)?
Since the question is "can I seek to positions
> 2**31" it seems easier to just try to seek
to something that high up. The OP pointed out
that /dev/null supports seeks, making it the
easiest one to test on a Unix system.
I looked in the available configuration information
(distutils.sysconfig and grepping
/usr/local/lib/python2.4/config ) but didn't
see any mention of HAVE_LARGEFILE_SUPPORT so I
don't think it's possible for the runtime Python
to figure that information expect by testing
the function calls.
dalke at dalkescientific.com
More information about the Python-list