On Fri, Apr 6, 2012 at 12:22 AM, Oleg Broytman <p...@phdru.name> wrote:
> On Thu, Apr 05, 2012 at 11:45:06PM +0900, Stephen J. Turnbull wrote:
>> On Thu, Apr 5, 2012 at 10:34 PM, Oleg Broytman <p...@phdru.name> wrote:
>> >   Why doesn't open() return None for a non-existing file? or
>> > socket.gethostbyname() for a non-existing name?
>>
>> That's not an answer to my question, because those calls have very
>> important use cases

Note, implicit existential quantifier.

>   Counterexamples

Not an argument against an existential quantifier.

> But Python doesn't allow [use of conditional constructs when opening a series 
> of files, one must trap exceptions].

True.  Python needs to make a choice, and the existence of important
cases where the user knows that the object (file) exists makes it
plausible that the user would prefer an Exception.  Also, open() is
intended to be a fairly thin wrapper over the OS facility, and often
the OS terms a missing file an "error".

I might have chosen to implement a 'None' return if I had designed
open(), but I can't get too upset about raising an Exception as it
actually does.

What I want to know is why you're willing to assert that absence of a
clock of a particular configuration is an Exception, when that absence
clearly documented to be a common case?  I don't find your analogies
to be plausible.  They seem to come down to "sometimes in Python we've
made choices that impose extra work on some use cases, so we should
impose extra work on this use case too."  But that surely isn't what
you mean.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to