On 29 August 2010 04:36, Stefan Behnel <[email protected]> wrote:
> Lisandro Dalcin, 29.08.2010 03:39:
>
>> On the other hand, I do not care too much if this is implemented going
>> through a descriptor, but as I'm not going to use this feature anyway.
>
> I think that describes the main use case already: "I won't use it in my
> code, but the users of my code *may* want to have it". That's the main
> reason why I'm advocating a low impact for the unused case.
>

If users want a dict in their instances, then use a subclass. That the
way to have to do it for built-in types like list or dict. Take into
account that adding a __dict__ will waste a pointer in your object
structure.

> Note that your patch only solves half of the problem that Neal describes:
> it implements __dict__ for instances but not for types.

Adding support for modifying type dict's is a completely different
feature. It will require more careful implementation because of the
type cache in Py>=2.6, and it would likely require some dedicated
syntax of @cython decorator, because cdef __dict__ would apply to
instances and not to the type.


-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to