This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.snow
Recipients christian.heimes, eric.araujo, eric.smith, eric.snow, rhettinger, vstinner
Date 2014-03-18.07:33:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1395128000.16.0.596461368982.issue19640@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-03-18 07:33:20eric.snowsetrecipients: + eric.snow, rhettinger, vstinner, eric.smith, christian.heimes, eric.araujo
2014-03-18 07:33:20eric.snowsetmessageid: <1395128000.16.0.596461368982.issue19640@psf.upfronthosting.co.za>
2014-03-18 07:33:20eric.snowlinkissue19640 messages
2014-03-18 07:33:19eric.snowcreate