New PEP: Attribute Access Handlers
Gordon McMillan
gmcm at hypernet.com
Sun Jul 23 14:02:54 EDT 2000
More information about the Python-list mailing list
Sun Jul 23 14:02:54 EDT 2000
- Previous message (by thread): New PEP: Attribute Access Handlers
- Next message (by thread): New PEP: Attribute Access Handlers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Neel Krishnaswami wrote: >Gordon McMillan <gmcm at hypernet.com> wrote: [Paul's proposal creates one access handler per attribute...] >I'm afraid I still don't understand. Oh, I think you do <wink>. >If I wanted to use separate >accessors/mutators, what would I do with the current proposal? One possibility is to oppose it, though that's probably not necessary, since it's not yet coherent. >An example (using separate accessors) that I'd like to see translated: > >class Foo: > def __init__(self, x): > self.x = x > > >class LogWrites(Foo): > def __set_x__(self, x, val): > add_to_write_log() > self.__dict__['x'] = val The current proposal is to write def __attr_x__(self, op, val=None): if op == 'get': ... elif op == 'set': ... elif op == 'del': ... IOW, in the current proposal, you can't. - Gordon
- Previous message (by thread): New PEP: Attribute Access Handlers
- Next message (by thread): New PEP: Attribute Access Handlers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list