Message90648
I agree with Nick.
And if you really want to, you could hack a Pickler subclass to support
NoneType:
import io
import pickle
class XPickler(pickle.Pickler):
def persistent_id(self, obj):
if obj is type(None):
return "NoneType"
return None
class XUnpickler(pickle.Unpickler):
def persistent_load(self, persistent_id):
if persistent_id == "NoneType":
return type(None)
def dumps(obj):
f = io.BytesIO()
XPickler(f).dump(obj)
return f.getvalue()
def loads(s):
return XUnpickler(io.BytesIO(s)).load()
Not super elegant, but it works:
>>> loads(dumps([type(None), None]))
[<type 'NoneType'>, None] |
|
Date |
User |
Action |
Args |
2009-07-17 22:58:46 | alexandre.vassalotti | set | recipients:
+ alexandre.vassalotti, georg.brandl, ncoghlan, hagen, july |
2009-07-17 22:58:46 | alexandre.vassalotti | set | messageid: <1247871526.85.0.217019057294.issue6477@psf.upfronthosting.co.za> |
2009-07-17 22:58:45 | alexandre.vassalotti | link | issue6477 messages |
2009-07-17 22:58:44 | alexandre.vassalotti | create | |
|