Improving Python (was: Lambda going out of fashion)

Fredrik Lundh fredrik at pythonware.com
Sun Dec 26 09:19:58 EST 2004


Aahz wrote:

>>(I've said it before, and I'll say it again: native unicode and
>>generators are the only essential additions I've seen since 1.5.2, with
>>properties and sub-classable C types sharing a distant third place.
>>the rest of the stuff has had zero impact on my ability to write solid
>>code in no time at all, and negative impact on my ability to download
>>stuff that others have written and expect it to work in any Python
>>version but the latest...)
>
> Hmmm...  I find code much more readable and writable now that apply() is
> going away.  And unless you mean "generator" to include iterators in
> general, I believe that iterators are another critical addition.
>
> I'm surprised that you don't include garbage collection and augmented
> assignment, though.  String methods have been a net gain, I think.

garbage collection is a CPython implementation detail, not a language
property (it's a nice implementation detail, sure).

and we had iterators before we got the iterator protocol; the protocol made
things slightly more convenient, but it didn't enable you to do anything you
couldn't do before (using __getitem__ instead of __next__).  generators are
something entirely different.  writing inverted code is hard; yielding is trivial.

func(*arg) instead of apply() is a step back -- it hides the fact that functions
are objects, and it confuses the heck out of both C/C++ programmers and
Python programmers that understand the "def func(*arg)" form, because it
looks like something it isn't (there's a false symmetry between the call-form
and the def-form).

and I still do enough 1.5.2-programming to use "x = x + y"; when I find
myself in a situation where my code would benefit a lot from being able to
write "x += y" instead, I go back and fix the design.

string methods are nice, but nothing groundbreaking, and their niceness is
almost entirely offset by the horrid "".join(seq) construct that keeps popping
up when people take the "the string module is deprecated" yada yada too
seriously.  and what do the python-devers do?  they add a "sum" built-in,
but no "join"?  hello?

</F> 






More information about the Python-list mailing list