__dict__ attribute for built-in types

MRAB python at mrabarnett.plus.com
Thu Oct 27 20:02:52 EDT 2011


On 28/10/2011 00:36, candide wrote:
> Le 28/10/2011 00:57, Hrvoje Niksic a écrit :
>
>> was used at class definition time to suppress it. Built-in and
>> extension types can choose whether to implement __dict__.
>>
>
> Is it possible in the CPython implementation to write something like this :
>
> "foo".bar = 42
>
> without raising an attribute error ?

No, built-in classes written in C have certain limitations, but why
would you want to do that anyway?



More information about the Python-list mailing list