Robert Bradshaw, 03.11.2010 08:25:
> On Tue, Nov 2, 2010 at 11:56 PM, Stefan Behnel wrote:
>> Robert Bradshaw, 03.11.2010 07:29:
>>> On that note, should we
>>> require an explicit self.obj.x, or is self implicit? (The latter makes
>>> it impossible to refer to non-attributes, and is bad according to the
>>> zen of Python...), so I'd lean against this one.
>>
>> That's a very good idea. Makes it more readable and a lot clearer what
>> happens. This also removes the link to C++ as you can access any attribute
>> of the type in one way or another.
In another post, I wrote that "special cases are not special enough to
break the rules", and it made me change my opinion here. It's normal Python
behaviour to look up names in either the current or the global namespace,
and potentially in a surrounding closure. The same should apply here.
This means that I'm no longer a supporter of requiring "self" here. "self"
may be a common convention, but it is not actually defined in the context
of the property statement. I think it should be
cdef class MyType:
cdef SomeStruct the_struct
property i from the_struct.i
where "the_struct" is looked up in the class scope or surrounding scope,
i.e. the property expression simply gets evaluated in the normal chain of
scopes in which it is defined.
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev