Re: Exceptions are not just for errors

2010-10-14 Thread Gregory Ewing
Ben Finney wrote: Another way of thinking about it is that there's no sensible sequence of bytes to return at EOF, so the Pythonic thing to do is to raise an exception for this exceptional circumstance. But this is *not* what Python does, so it's obviously not Pythonic. :-) If f.read(n) is to

Re: Exceptions are not just for errors (was: My first Python program)

2010-10-13 Thread Emmanuel Surleau
> Seebs writes: > > On 2010-10-13, Chris Rebert wrote: > > > For future reference, the significant majority of things in Python > > > raise exceptions upon encountering errors rather than returning > > > error values of some sort. > > > > Yes. I'm getting used to that -- it's a bit of a shift,

Exceptions are not just for errors (was: My first Python program)

2010-10-13 Thread Ben Finney
Seebs writes: > On 2010-10-13, Chris Rebert wrote: > > For future reference, the significant majority of things in Python > > raise exceptions upon encountering errors rather than returning > > error values of some sort. > > Yes. I'm getting used to that -- it's a bit of a shift, because I'm >