ctypes mystischer dir()-Aufruf
Verfasst: Freitag 15. Februar 2008, 17:13
Kann mir dieses Verhalten jemand erklären?
Zunächst steht mir laut dir() ctypes.windll.user32 gar nicht zur Verfügung. Erst wenn ich es aus heiterem Himmel mal "anspreche", liefert mir dir(ctypes.windll) plötzlich auch 'user23' ganz hinten dran.
Woher weiß ich denn, was ich da noch so alles ansprechen kann, obwohl es mir dir() nicht verrät?
Code: Alles auswählen
>>> import ctypes
>>> dir(ctypes.windll)
['LoadLibrary', '__class__', '__delattr__', '__dict__', '__doc__', '__getattr__',
'__getattribute__', '__getitem__', '__hash__', '__init__', '__module__',
'__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__',
'__weakref__', '_dlltype', 'kernel32']
>>> ctypes.windll.user32
<WinDLL 'user32', handle 7e360000 at 14ea450>
>>> dir(ctypes.windll)
['LoadLibrary', '__class__', '__delattr__', '__dict__', '__doc__', '__getattr__',
'__getattribute__', '__getitem__', '__hash__', '__init__', '__module__',
'__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__',
'__weakref__', '_dlltype', 'kernel32', 'user32']
>>>
Woher weiß ich denn, was ich da noch so alles ansprechen kann, obwohl es mir dir() nicht verrät?