Jason R. Coombs <[email protected]> added the comment:
That was easier than I thought. The generated code is _ugly_ but it did
seem to be able to generate it.
I created init.pyx
{{{
class X(object):
def __init__(self, *args, **kw):
"""This is how the Structure's __init__method SHOULD be"""
if args:
names = []
for tp in self.__class__.mro()[2::-1]:
for n, _ in tp._fields_:
names.append(n)
for n, v in zip(names, args):
setattr(self, n, v)
for n, v in kw.iteritems():
setattr(self, n, v)
}}}
Then, ran cython init.pyx and got the attached file.
Is that any help?
----------
Added file: http://bugs.python.org/file14920/init.c
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue5042>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com