[issue1831] ctypes.Structure constructor arguments
Armin Rigo
report at bugs.python.org
Tue Jan 15 16:12:34 CET 2008
Armin Rigo added the comment:
The pure Python implementation we just wrote in PyPy is:
for name, arg in zip(names, args):
if name in kwds:
raise TypeError("duplicate value for argument %r" % (
name,))
self.__setattr__(name, arg)
for name, arg in kwds.items():
self.__setattr__(name, arg)
It's the same logic as in _ctypes.c:Struct_init(), where you can add the
C equivalent of "if name in kwds" after getting the name.
----------
keywords: +easy
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1831>
__________________________________
More information about the Python-bugs-list
mailing list