Robert Bradshaw wrote:
> On Feb 21, 2009, at 12:26 PM, Stefan Behnel wrote:
>> I found this code in the struct_conversion.pyx test:
>>
>> ----------------------------------
>>>>> test_constructor_kwds(1.25, 2.5, 128)
>> {'y': 2.5, 'x': 1.25, 'color': 128}
>>
>> ...
>>
>>
>> def test_dict_construction(x, y, color):
>> cdef Point p = {'color': color, 'x': x, 'y': y}
>> return p
>>
>> def test_constructor_kwds(x, y, color):
>> cdef Point p = Point(x=x, y=y, color=color)
>> return p
>> ----------------------------------
>>
>> Should we really base this feature on byte strings instead of
>> unicode strings?
>
> They should be str, i.e. byte strings in Py2, and unicode strings in
> Py3. (Basically, it's like the attribute dict of a struct).
I thought about this a bit. This makes sense, as struct member names should
behave like class attributes for the above feature, i.e. they are identifiers.
+1
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev