On 2016-03-15, Marko Rauhamaa wrote:
> Jon Ribbens :
>> On 2016-03-15, Marko Rauhamaa wrote:
>>> I think it points to a big practical problem in the whole exception
>>> paradigm.
>>
>> Well, no. That one individual language screwed up its implementation
>> of exceptions does not mean the whole co
Jon Ribbens :
> On 2016-03-15, Marko Rauhamaa wrote:
>> Having to specify the possible exceptions in Java is very painful and
>> has complicated the introduction of closures to Java quite a bit.
>
> It is one of the extremely serious design errors in Java, I think.
>
>> I think it points to a big
On 2016-03-15, Marko Rauhamaa wrote:
> Jon Ribbens :
>> I'd just do something like:
>>
>> try:
>> fileobj.seek(where-i-want-to-seek-to)
>> except (AttributeError, EnvironmentError):
>> # file is not seekable
>
> Unlike Java, Python does not declare syntactically which exceptions th
Jon Ribbens :
> I'd just do something like:
>
> try:
> fileobj.seek(where-i-want-to-seek-to)
> except (AttributeError, EnvironmentError):
> # file is not seekable
Unlike Java, Python does not declare syntactically which exceptions the
caller should expect. Unfortunately, the libra
On 2016-03-15, Steven D'Aprano wrote:
> Suppose somebody passes me an open file handle. What's the right way to tell
> if it is seekable in Python 2?
>
> I see that stdin has a seek and tell method, but they raise:
>
> py> sys.stdin.tell()
> Traceback (most recent call last):
> File "", line 1,
Suppose somebody passes me an open file handle. What's the right way to tell
if it is seekable in Python 2?
I see that stdin has a seek and tell method, but they raise:
py> sys.stdin.tell()
Traceback (most recent call last):
File "", line 1, in
IOError: [Errno 29] Illegal seek
Are seek and te