New submission from Eli Bendersky:
[this came up as part of the Enum discussions. Full details in this thread:
http://mail.python.org/pipermail/python-dev/2013-May/126076.html]
namedtuple currently uses this code to obtain the __module__ for the class it
creates dynamically so that pickling works:
result.__module__ = _sys._getframe(1).f_globals.get('__name__', '__main__')
This may not work correctly on all Python implementations, for example
IronPython.
To support some way to pickle on all implementations, namedtuple should support
a fully qualified name for the class:
Point = namedtuple('mymodule.Point', ['x', 'y'])
If the name is a qualified dotted name, it will be split and the first part
becomes the __module__.
----------
components: Library (Lib)
messages: 188748
nosy: eli.bendersky, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: namedtuple should support fully qualified name for more portable pickling
type: behavior
versions: Python 3.4
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue17941>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com