Accessors in Python (getters and setters)

ZeD vito.detullio at gmail.com
Tue Jul 11 02:07:33 EDT 2006


Bruno Desthuilliers wrote:

>> I decided to change the name of an attribute. Problem is I've used the
>> attribute in several places spanning thousands of lines of code. If I
>> had encapsulated the attribute via an accessor, I wouldn't need to do
>> an unreliable and tedious search and replace
> find and grep are usually mostly reliable for this kind of tasks.

you mean sed :)

sed 's/oldName/newName/g' oldFile > newFile

-- 
Under construction



More information about the Python-list mailing list