Bruno Desthuilliers wrote: > ZeD wrote: > > 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 :) > > No, I meant find and grep. > > > sed 's/oldName/newName/g' oldFile > newFile > > > Yeah, fine - as long as your pretty sure the same name is not used in > other contexts in any of the source files... > > -- > bruno desthuilliers > python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for > p in '[EMAIL PROTECTED]'.split('@')])"
I think that was the original point about find/replace: it can be really hard to automate a name change, because changes might occur that you didn't intend; whereas, doing things by hand lacks consistency. My solution is to use emacs' query-replace (which you can invoke with M-%). It will find quicly and accurately, but I ultimately hold the key to whether something gets replaced or not. -- http://mail.python.org/mailman/listinfo/python-list