Dynamic call of a method : error

Dublanc, David ddublanc at free.fr
Wed Jul 4 18:03:43 EDT 2001


Hello, when I execute the module :
***************
L = []

for method in dir(L):
    "dynamic call"
    print L.method.__doc__
****************

I have the following error :

PythonWin 2.1 (#15, Apr 23 2001, 18:00:35) [MSC 32 bit (Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond (MarkH at ActiveState.com) - see
'Help/About PythonWin' for further copyright information.
Traceback (most recent call last):
  File "f:\python21\pythonwin\pywin\framework\scriptutils.py", line 301, in
RunScript
    exec codeObject in __main__.__dict__
  File "G:\script python\test concaténation.py", line 5, in ?
    print L.method.__doc__
AttributeError: method


How can I call a method dynamically ?

Thanks.

Regards,
--
David





More information about the Python-list mailing list