Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > type(None)()

Reply
Thread Tools

type(None)()

 
 
Ethan Furman
Guest
Posts: n/a
 
      08-16-2012
Hans Mulder wrote:
> On 8/08/12 04:14:01, Steven D'Aprano wrote:
>> NoneType raises an error if you try to create a second instance. bool
>> just returns one of the two singletons (doubletons?) again.
>>
>> py> type(None)()
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> TypeError: cannot create 'NoneType' instances

>
> Why is that?


An oversight, and until a few months ago nobody had complained loud
enough.


> Why doesn't it just return an existing instance of the type,
> like bool, int, str and other built-in non-mutable types do?


In 3.3 it now does.

~Ethan~
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments