On Tue, Aug 16, 2011 at 11:30 AM, antoine.pitrou <python-check...@python.org> wrote: > +Serializing "pseudo-global" objects > +----------------------------------- > + > +Objects which are not module-global, but should be treated in a similar > +fashion -- such as methods [4]_ or nested classes -- cannot currently be > +pickled (or, rather, unpickled) because the pickle protocol does not > +correctly specify how to retrieve them. One solution would be through the > +adjunction of a ``__namespace__`` (or ``__qualname__``) to all class and > +function objects, specifying the full "path" by which they can be retrieved. > +For globals, this would generally be ``"{}.{}".format(obj.__module__, > obj.__name__)``. > +Then a new opcode can resolve that path and push the object on the stack, > +similarly to the GLOBAL opcode. > +
I think this is the part that ties in with the pickle-related aspects for PEP 395 - using '__qualname__' would be one way to align a module's real name with where it should be retrieved from and where it's documentation lives (I like 'qualified name' as a term, too). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com