[Python-Dev] NoneType(None) raises exception

Devin Jeanpierre jeanpierreda at gmail.com
Fri Apr 26 04:25:02 CEST 2013


On Thu, Apr 25, 2013 at 9:12 PM, MRAB <python at mrabarnett.plus.com> wrote:
>> Only when you write it out like that as constants. It's no more,
>> or less, strange than str('spam') or int(1) or list([]). Why
>> would you do that?
>>
> None is a singleton, but instances of str, int, list, etc aren't. Why
> can it take an argument when there's only ever one of them?
>
> That's why it seems strange to me.

How about bool? False and True are singletons much like None is, and
bool(False) == False; bool(True) == True.

Sure the distinction is that all of those are useful as conversion
functions, whereas NoneType would never be used that way.

-- Devin


More information about the Python-Dev mailing list