[Python-ideas] An Everything singleton

spir denis.spir at gmail.com
Wed Feb 19 00:06:22 CET 2014


On 02/18/2014 08:27 PM, Guido van Rossum wrote:
> This idea comes up occasionally (though I've never heard it named
> "everything" before). I believe it is similar to a feature in Objective-C
> (or maybe just Apple's version) where the behavior is that if you send any
> message to nil it does nothing and returns nil.
>
> In Python I think it would be very disturbing though and would end up
> masking errors.

Yes; and unfortunately this often happens (also with none in python, when 
misused); there are related discussion about NaN as well (eg see Eiffel), and 
with funcs which try to guess clients' needs instead of just failing.

>  (Python and ObjC seems to have very different attitudes
> about exceptions -- in Python they are used all the time while in ObjC the
> culture seems to favor the idea that exceptions are fatal and shouldn't
> even be caught.)

(Rather, they are for cases of failures impredictable on the client side (eg 
file not found), which are not programmer errors (the cases belong to the app 
logic); in such a case, one may catch and deal with the case (eg create the file)).

d



More information about the Python-ideas mailing list