Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #104939

Re: Seekable files

Path csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Jon Ribbens <jon+usenet@unequivocal.co.uk>
Newsgroups comp.lang.python
Subject Re: Seekable files
Date Tue, 15 Mar 2016 13:49:44 -0000 (UTC)
Organization A noiseless patient Spider
Lines 39
Message-ID <slrnneg4tk.19u.jon+usenet@wintry.unequivocal.co.uk> (permalink)
References <56e7e57a$0$1589$c3e8da3$5496439d@news.astraweb.com> <slrnnefqbq.19u.jon+usenet@wintry.unequivocal.co.uk> <87a8m0dm96.fsf@elektro.pacujo.net>
Injection-Date Tue, 15 Mar 2016 13:49:44 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="ba273c0c5d7577399b57ba7b03035ea2"; logging-data="30928"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/rIjXpF5j07S1yyPZ+RXGPILMlTVEGY/I="
User-Agent slrn/1.0.2 (Linux)
Cancel-Lock sha1:20lWnk3T0k+admDiNdYQUKFI+XM=
Xref csiph.com comp.lang.python:104939

Show key headers only | View raw


On 2016-03-15, Marko Rauhamaa <marko@pacujo.net> wrote:
> Jon Ribbens <jon+usenet@unequivocal.co.uk>:
>> 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 library documentation is not
> clear on it, either. So it is often a bit difficult to write proper
> try-except logic around a function.

This is true, although I'm not sure why you are mentioning it here
since I'm fairly sure the above code suggestion is reasonably correct
and the documentation is pretty clear.

> 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 practical problem in the whole exception
> paradigm.

Well, no. That one individual language screwed up its implementation
of exceptions does not mean the whole concept of exceptions is broken.

> Makes you wonder if the old error code mechanism would have
> been better, after all. ("Why does Go not have exceptions?" <URL:
> https://golang.org/doc/faq>.)

I think they are wrong, and indeed their argument seems to be a
ludicrous one based upon a misunderstanding of the English meaning of
the word "exception"!

Any high-level language that does not include exceptions is not fit
for purpose, in my opinion.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Seekable files Steven D'Aprano <steve@pearwood.info> - 2016-03-15 21:35 +1100
  Re: Seekable files Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2016-03-15 10:49 +0000
    Re: Seekable files Marko Rauhamaa <marko@pacujo.net> - 2016-03-15 13:16 +0200
      Re: Seekable files Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2016-03-15 13:49 +0000
        Re: Seekable files Marko Rauhamaa <marko@pacujo.net> - 2016-03-15 16:26 +0200
          Re: Seekable files Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2016-03-15 14:25 +0000

csiph-web