[Python-Dev] PEP 549: Instance Properties (aka: module properties) (original) (raw)
Ivan Levkivskyi levkivskyi at gmail.com
Wed Sep 13 18:01:21 EDT 2017
- Previous message (by thread): [Python-Dev] PEP 549: Instance Properties (aka: module properties)
- Next message (by thread): [Python-Dev] PEP 549: Instance Properties (aka: module properties)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
@Guido
One would have to introduce some kind of convention where you can write properties with a leading
One doesn't even need the @property decorator in this case. For example:
def getattr(name): g = globals() name = '_' + name if name in g: return gname raise AttributeError(...)
def _attr(): "do something" return actual_object
One can even write a decorator that would change the name automatically (but this will require a call at the end of module to unbind original names). The space for play is infinite. The question is what exactly is needed. I would say that already basic customisation (like getattr) will be enough. IIUC, this will be actually a bit faster than setting class since only "customized" attributes will be affected.
-- Ivan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20170914/9cb01f0e/attachment.html>
- Previous message (by thread): [Python-Dev] PEP 549: Instance Properties (aka: module properties)
- Next message (by thread): [Python-Dev] PEP 549: Instance Properties (aka: module properties)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]