Mitko Haralanov wrote:
> On 18 Oct 2006 14:38:12 -0700
> [EMAIL PROTECTED] wrote:
>
> > >>> class test(object):
> > ...  def a_method(self,this,that):
> > ...   print self.a_method.__name__
>
> Doing the above will obviously work!
>
> However, I don't want to have to use the name of the function in the
> print statement (the ".a_method." part). Imagine having about 100 of
> the above print statements in the function and then you change the name
> of the function. I want all 100 of the print statements to work without
> having to change every one of them to reflect the new function name.

Thats what I thought..
I dont know if there is a python way of doing it, but if replacing text
is the only concern, wouldnt a good editor with regex search+replace
make the job easier ?

or if your in a unix with ksh / pdksh

for f in $(ls)
do
 sed -e "s/print self.a_method.__name__/print self.new_name.__name/g"
done

or similar...

I'm not helping much, am I :)

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to