Unification of Methods and Functions

David MacQuigg dmq at gain.com
Mon May 24 17:37:06 EDT 2004


On Mon, 24 May 2004 14:39:11 +1200, Greg Ewing
<greg at cosc.canterbury.ac.nz> wrote:

>David MacQuigg wrote:
>
>> Nobody seems to understand that lambda functions, static methods, etc.
>> are clutter.
>
>On the contrary, lambda has long been regarded as a wart
>for various reasons. The best way to fix it is probably
>to just drop it altogether. Nothing essential would be
>lost.

If "lambda functions" were nothing but functions with the name left
off, they would serve their current purpose, and they would not be
such a problem that there is talk of actually taking them *out* of the
language.  They aren't essential, but they do serve a purpose which
some feel is important.

>We don't see static methods as clutter, because for the
>most part we don't see them (i.e. we don't normally use
>them). It would be no great loss if they were dropped,
>too.

I would see it as a loss.  The next best alternative is to move the
static method outside of the class, and that puts an arbitrary
restriction on how I can structure my programs.  If the person writing
the program feels that the function belongs in the class, let's not
say it can't be done because either a) The syntax doesn't allow it. or
b) We assume he is wrong in thinking his function belongs inside his
class.

My perspective may be different, because I have not yet absorbed the
Python traditions, and I don't have any instictive avoidance of static
methods.

>In neither case is it necessary to fundamentally
>redesign the language to fix these, even if
>they are regarded as problems.

The proposed change are minimal, and could be done in the next
non-backward compatible upgrade (Python 3?).  Unlike Prothon, I am
very concerned about the ability to automatically migrate existing
Python programs to the new syntax.  I believe that is possible with
the proposed syntax.

I believe the changes will make it easier for beginners to learn
Python OOP, and at worst, be a minor and temporary annoyance for
experts.  I would expect learning the simpler syntax would take an
expert two hours at the most.

-- Dave




More information about the Python-list mailing list