[Python-Dev] Could these restrictions be removed? (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Thu May 12 19:05:46 CEST 2011
- Previous message: [Python-Dev] Could these restrictions be removed?
- Next message: [Python-Dev] Could these restrictions be removed?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 12 May 2011 11:33:37 -0500 (CDT) Skip Montanaro <skip at montanaro.dyndns.org> wrote:
A friend at work who is new to Python wondered why this didn't work with pickle: class Outer: Class Inner: ... def init(self): self.i = Outer.Inner() [...] I've never questions this, but I wonder, is this a fundamental restriction or could it be overcome with a modest amount of work?
pickle uses heuristics to try to find out the "official name" of a class or function. It would be a matter of improving these heuristics.
There are other cases in which pickle similarly fails:
pickle.dumps(random.random) b'\x80\x03crandom\nrandom\nq\x00.' pickle.dumps(random.randint) Traceback (most recent call last): File "", line 1, in _pickle.PicklingError: Can't pickle <class 'method'>: attribute lookup builtins.method failed
Regards
Antoine.
- Previous message: [Python-Dev] Could these restrictions be removed?
- Next message: [Python-Dev] Could these restrictions be removed?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]