New PEP: Attribute Access Handlers

Robin Becker robin at jessikat.fsnet.co.uk
Sat Jul 22 03:25:01 EDT 2000


In article <39792C74.E7E3DB2B at prescod.net>, Paul Prescod
<paul at prescod.net> writes
>Bjorn Pettersen wrote:
>> 
>> Justification, Scenario 4:
>> 
>>    An existing class has a string attribute, however the most common
>> operation on it is appending to the end. Through the profiler you find
>> that this operation is taking up 95% of the applications time. You want
>> to change the implementation to cStringIO for efficiency (total
>> execution time for your application goes from 90 seconds to 3 secs).
>
>Actually, I'm not sure if my proposal would help here. Appending to a
>cStringIO is not an assignment operation...
>
...
If the attr is a mutable sequence/map etc how can they be made readonly
using this scheme, are we forced to make immutable string types etc
-- 
Robin Becker



More information about the Python-list mailing list