Self function

Rhodri James rhodri at wildebst.demon.co.uk
Wed May 6 20:59:02 EDT 2009


On Wed, 06 May 2009 23:33:20 +0100, Luis Alberto Zarrabeitia Gomez  
<kyrie at uh.cu> wrote:

> Quoting Rhodri James <rhodri at wildebst.demon.co.uk>:
>> So the answer to my question would be "nothing"?
>
> Indeed, there is nothing broken with the search and replace feature of  
> his editor. When he is copying a non-recursive function, it is
> _useless_ to do a search and replace. When he is copying a recursive
> function, it is _required_ to do a search and replace.

On the contrary, it's merely not very useful for a non-recursive
function.  It still changes the function's name, which was one of the
objectives.  Seriously, the lack of effort in (say) doing a quick
incremental search for the function's name is a no-brainer.

> So, the very same task requires you to either perform a task that will  
> almost always be useless (or even dangerous), or to read the source code
> to find out if the function is recursive, so that you can use the search
> and replace only then.

If you're copying code without reading it, you're going to get bitten
anyway some time.  My sympathy is still limited.

> (I know that the "problem" is present in almost all programming  
> languages... but that's not what is being discussed. Bearophile's
> concerns seem legitimate, and you should not dismiss them so lightly
> just because there are ways to do more work and hopefully avoid the
> problems. I'd say that the "problem" is even aggravated in python,
> where the dynamic nature of the language makes it near to
> impossible to build good refactoring tools)

As with that other great "problem" of python, the lack of private
class attributes, a tiny amount of self-discipline solves 90% of the
issues.

-- 
Rhodri James *-* Wildebeeste Herder to the Masses



More information about the Python-list mailing list