[Python-ideas] An Everything singleton

Guido van Rossum guido at python.org
Tue Feb 18 20:27:05 CET 2014


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. (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.)


On Tue, Feb 18, 2014 at 11:09 AM, Amber Yust <amber.yust at gmail.com> wrote:

> Your examples do not make sense to me.
>
>
> On Tue Feb 18 2014 at 11:08:00 AM, Serhiy Storchaka <storchaka at gmail.com>
> wrote:
>
>> This crazy idea is inspired by a discussing in Python-Dev which should
>> be here.
>>
>> Currently we have a None singleton which representing nothing and raises
>> an exception in almost all operations (except equality, etc). What about
>> introducing its antonym, an Everything singleton (the name is
>> discussable), which newer raises an exception in any operation, but
>> returns consistent value?
>>
>>  >>> Everything + 2
>> 2
>>  >>> Everything < 3
>> True
>>  >>> Everything * 'foo'
>> 'foo'
>>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140218/e38d8ad6/attachment.html>


More information about the Python-ideas mailing list