Hi,
I am having trouble figuring out how to set up an object to be
scriptable through the C API. An example of what I am attempting to
do:
[color=blue][color=green][color=darkred]
>>> obj = foo.Foo()
>>> obj["key"][/color][/color][/color]
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: unsubscriptable object[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
I've tried defining __getitem__ as a method, but that hasn't worked.
Is there a tp_field that I am failing to understand, something like
tp_iter and tp_iternext?
thanks~
I am having trouble figuring out how to set up an object to be
scriptable through the C API. An example of what I am attempting to
do:
[color=blue][color=green][color=darkred]
>>> obj = foo.Foo()
>>> obj["key"][/color][/color][/color]
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: unsubscriptable object[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
I've tried defining __getitem__ as a method, but that hasn't worked.
Is there a tp_field that I am failing to understand, something like
tp_iter and tp_iternext?
thanks~
Comment