Could these restrictions be removed?

May 12, 2011
11:33 a.m.
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 explained:
http://docs.python.org/library/pickle.html#what-can-be-pickled-and-unpickled
From that:
# functions defined at the top level of a module # built-in functions defined at the top level of a module # classes that are defined at the top level of a module
I've never questions this, but I wonder, is this a fundamental restriction or could it be overcome with a modest amount of work? Just curious... Skip

5135
Age (days ago)
5135
Last active (days ago)
3 comments
3 participants
participants (3)
-
Antoine Pitrou
-
Skip Montanaro
-
Walter Dörwald