How can I define __getattr__ to operate on all items of container and pass arguments?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Tue Feb 15 15:58:25 EST 2011
More information about the Python-list mailing list
Tue Feb 15 15:58:25 EST 2011
- Previous message (by thread): How can I define __getattr__ to operate on all items of container and pass arguments?
- Next message (by thread): How can I define __getattr__ to operate on all items of container and pass arguments?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 15 Feb 2011 12:29:36 -0800, Jeremy wrote: > def __getattr__(self, name): > for I in self.items: > # How can I pass arguments to I.__dict__[name]? > I.__dict__[name] The same way you would pass arguments to any other function: with function call syntax. I.__dict__[name](arg1, arg2, arg3, ...) -- Steven
- Previous message (by thread): How can I define __getattr__ to operate on all items of container and pass arguments?
- Next message (by thread): How can I define __getattr__ to operate on all items of container and pass arguments?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list