Is this considered black magic?
Rainer Deyke
root at rainerdeyke.com
Sun Nov 11 17:25:05 EST 2001
More information about the Python-list mailing list
Sun Nov 11 17:25:05 EST 2001
- Previous message (by thread): Is this considered black magic?
- Next message (by thread): Is this considered black magic?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Laura Creighton" <lac at strakt.com> wrote in message news:mailman.1005512294.21291.python-list at python.org... > > Okay, new version: > > Did I miss something? You might also want to support keyword arguments. > def foreach(object_list, method_name, *args): def foreach(object_list, method_name, *args, **kwargs): > for object in object_list: > try: > method = getattr(object, method_name) > except AttributeError: > pass > else: > if callable(method): > method(*args) method(*args, **kwargs) -- Rainer Deyke (root at rainerdeyke.com) Shareware computer games - http://rainerdeyke.com "In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
- Previous message (by thread): Is this considered black magic?
- Next message (by thread): Is this considered black magic?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list