Python dynamic attribute creation

WANG Cong xiyou.wangcong at gmail.com
Sat Jun 26 00:04:50 EDT 2010


On 06/25/10 22:11, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:

> On 25/06/2010 19:23, WANG Cong wrote:
>> On 06/25/10 14:31, Richard Thomas<chardster at gmail.com>  wrote:
>>
>> <snip>
>>
>>>
>>> If you desperately want to limit the attribute assignments that can be
>>> performed on an object you can set the __slots__ attribute of its
>>> type. However, the Python ethos has always been to restrict as little
>>> as necessary to provide the tools it needs. Performing additional
>>> checks every time an attribute assignment is performed is completely
>>> unnecessary. Remember that unlike C these checks would have to be
>>> performed at run-time.
>>>
>>
>> I don't care in which way I can limit this, I care why I should limit
>> this by default, not vice versa?
>>
>> Yeah, I do understand this could be a performance issue, but comparing
>> it with a language design issue, _I think_ the latter thing is much more
>> important than the former one.
>>
>
> Blimey, one minute we're talking about "Python dynamic attribute
> creation", the next it's a performance issue.  What do you want, blood
> on it?
>

No, I want people to focus on the language design things, not on
performance things. By talking about "Python dynamic attribute
creation", I want to question the language design of Python in this
point, actually. :)

If someone still insists that this should be a performance thing more
than language design thing, then I will give up because that is saying
this language is not beautiful on this point.

Thanks.

-- 
Live like a child, think like the god.
 



More information about the Python-list mailing list