[issue19640] Drop _source attribute of namedtuple

Eric Snow report at bugs.python.org
Tue Mar 18 08:33:20 CET 2014


Eric Snow added the comment:

It does not necessarily require a metaclass.  You can accomplish it using a custom descriptor:

class classattr:
    def __init__(self, getter):
        self.getter = getter
    def __get__(self, obj, cls):
        return self.getter(cls)

FWIW, this is a descriptor that may be worth adding somewhere regardless.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19640>
_______________________________________


More information about the Python-bugs-list mailing list