Message90641
Given that dumps(type(Ellipsis)) and dumps(type(NotImplemented)) don't
work either, I am reclassifying this as a documentation bug.
The thing about the types of these three objects (None, Ellipsis,
NotImplemented) is that they are all designed to be singletons and they
all disallow creation of new instances of them.
>>> type(None)()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: cannot create 'NoneType' instances
>>> type(NotImplemented)()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: cannot create 'NotImplementedType' instances
>>> type(Ellipsis)()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: cannot create 'ellipsis' instances
This does mean None has to be special cased if pickling "(object,
type(object))" pairs, but passing types through pickle strikes me as a
dubious enough exercise that it would take a fairly convincing use case
to accept an RFE to make NoneType pickleable (note that any such patch
would have to make sure that doing loads() on such a pickle didn't
manage to create a second copy of NoneType or None). |
|
Date |
User |
Action |
Args |
2009-07-17 22:21:07 | ncoghlan | set | recipients:
+ ncoghlan, georg.brandl, alexandre.vassalotti, hagen, july |
2009-07-17 22:21:06 | ncoghlan | set | messageid: <1247869266.89.0.631175770643.issue6477@psf.upfronthosting.co.za> |
2009-07-17 22:21:05 | ncoghlan | link | issue6477 messages |
2009-07-17 22:21:04 | ncoghlan | create | |
|