Pickle question

Mike Fletcher mfletch at tpresence.com
Sat Nov 4 07:10:09 CET 2000


Better (more explicit) to use something like this (untested, of course ;o)
):

class UnpicklableError(TypeError):
	def __getinitargs__( self ):
		raise self

UNPICKLABLEOBJECT = UnpicklableError()

So that you don't ever need to worry about people adding functionality to
pickle, you've explicitly made sure this object can never be pickled.

HTH,
Mike

-----Original Message-----
From: Carl Banks [mailto:idot at vt.edu]
Sent: Saturday, November 04, 2000 12:37 AM
To: python-list at python.org
Subject: Pickle question
...
So, what I do is add an unpicklable object as an attribute, like so:
	a.picklestop = Ellipsis

Now, my question is: is the Ellipsis object guaranteed to be
unpicklable in all future versions of Python, or might someone get
bored someday and decide to add Ellipsis support to the pickle module,
thus breaking my code?
...




More information about the Python-list mailing list