Lambda the Ultimate

inactiveTopic Python 2.1 Alpha
started 1/24/2001; 8:52:45 PM - last post 1/26/2001; 12:13:05 AM
Chris Rathman - Python 2.1 Alpha  blueArrow
1/24/2001; 8:52:45 PM (reads: 726, responses: 7)
Python 2.1 Alpha
The next version of Python in the pipeline with a number of fixes and some modest enhancements.

Still no sign of full lexical scoping, closures, and tail recursion. Maybe next version?

One other thing that does bug me about Python is all those __XXX__ name mangled methods for overriding the builtins. They just keep seeming to multiply out with each new version.
Posted to "" by Chris Rathman on 1/24/01; 8:55:47 PM

andrew cooke - Re: Python 2.1 Alpha  blueArrow
1/25/2001; 4:11:27 AM (reads: 738, responses: 0)
What would you do instead of _xxx_? Should they go completely? That would block a lot of wizardry/elegant tricks (IIRC Zope would have a fit). A completely different syntax? Dropping the "_"s?

If you drop "_"s then do you add/require an adjective to method declarations that override builtins? That's not very Pythonesque (imho). Alternatively, by dropping "_"s and adding no new sytnax, you run the risk of breaking new code. In the past I think Perl has gone down this route (adding compiler warnings to help bitten users), but for pretty obscure stuff (iirc).

I'd go for no "_"s and a compiler warning, but Python is aimed at newbies and I don't think they'd want to run the risk of alienating people.

Ah, syntax... :-)

John Lawter - Re: Python 2.1 Alpha  blueArrow
1/25/2001; 9:01:00 AM (reads: 750, responses: 0)
If you read Andrew Kuchling's summary of the new features in 2.1alpha1, you'll see that there is a PEP for adding static scoping to Python, to avoid (among other things) having to use defaults to bind values to arguments in lambdas. It just didn't make the release.

I don't feel that the (current) lack of static scoping, closures and tail recursion prevents me from getting my work done in any way. I would much rather see work done on interpreter to improve performance.

Chris Rathman - Re: Python 2.1 Alpha  blueArrow
1/25/2001; 10:50:46 AM (reads: 704, responses: 0)
What would you do instead of _xxx_?
I don't really have a solution. I just find it troublesome that the further along the language gets, the more of these __xxx__ keep cropping.

I guess to back up for a minute, I would have to guess why the signature was chosen. In Python, the leadin __ is a pseudo way to attain private methods. I would assume that all of these methods are supposed to be private methods that are not normally accessible through composition and object collaboration. The trailing __ is just a naming convention used that has no syntactic significance. Though many of these methods are used by the outside world - it's just that they are invoked by operators or more general functions.

It just may be me, but I find that it detracts from the readibility of the code. I don't think that Python will ever change the use of name mangling for the base object methods that are redefined in the subclasses. But I always like the idea of having the actual method names be as close as possible to the invocation names.

Chris Rathman - Re: Python 2.1 Alpha  blueArrow
1/25/2001; 11:01:23 AM (reads: 709, responses: 0)
I don't feel that the (current) lack of static scoping, closures and tail recursion prevents me from getting my work done in any way.
Don't get me wrong, I think Python is a great language that is quite useful. I'd just like to see it be as easy to do Functional Programming type constructs as it is to do modular and object-oriented styles. It's because it is so close to being a truly elegant language that makes it kind of frustrating.

I would much rather see work done on interpreter to improve performance.
I agree that optimization is a necessary thing, though for most of the stuff I do in Python it's not time critical. The problem with concentrating on optimization at this point in the evolution of the language is that it will just make it that much harder to change the semantics of the language down the road. Changing the scoping rules and adding true closures is likely to require changes in the optimization techniques. The longer they are delayed in introduction, the harder it's gonna be to break the optimized code.

Fredrik Lundh - Re: Python 2.1 Alpha  blueArrow
1/25/2001; 1:17:06 PM (reads: 695, responses: 0)
I guess to back up for a minute, I would have to guess why the signature was chosen. In Python, the leadin __ is a pseudo way to attain private methods. I would assume that all of these methods are supposed to be private methods that are not normally accessible through composition and object collaboration. The trailing __ is just a naming convention used that has no syntactic significance

__xxx__ was there from the beginning, while __xxx mangling is a relatively late addition (officially supported in 1.5).

__xxx__ names are not mangled.

John Lawter - Re: Python 2.1 Alpha  blueArrow
1/25/2001; 1:29:27 PM (reads: 721, responses: 0)
Well, Guido has said things which lead me to believe that hopes of Python becoming more functional are in vain. (Something to the effect of "Python is not a functional language, Python will never be a functional language.") Although it does offer things like map,filter and lambda, and functions are first class objects, I don't think things will progess much further in that direction. I tend to be more conservative, and would rather see a simple language with fewer features than a complicated language with many features.

Part of Python's charm (I think) is that it was until recently one man's vision of what a programming language should be. People responded to this and the community of users grew. Now, more and more features are being added, and I think Python may begin to lose its particular flavor. For example, I liked list comprehensions in Haskell and Miranda, but now that they're in Python, I'm not so sure how much I like them. Of course, this is also due to the fact that their implementation has not been optimized, so their performance lags compared to for. I'm not sure that tail recursion is necessary in a language that supports iteration, because the ability to use constant stack space is already present.

I would rather see work on the underlying interpreter done, so Python exhibits better speed and memory usage, rather than adding more questionable features or syntactic sugar. Down that road lies the way to PL/1 (or Ada !)

andrew cooke - Re: Python 2.1 Alpha  blueArrow
1/26/2001; 12:13:05 AM (reads: 730, responses: 0)
I think that's a good point. When I first met Python I had just started using Lisp and was starting to explore functional languages. At the time it was frustrating that it offered "bits" of functional languages without being really committed (my first post to c.l.python was to ask why tail recursion was so slow).

Now that I know more functional languages I can see that there are really better tools for the job, and Python can stick to doing what it does best. But maybe all I'm really saying is that I don't use Python much any more :-)

(The one place where I do use it is as a scripting language at work, in the hope that other software engineers, used to Java, will find it readable. So far that's proved a pretty vain hope and using list comprehensions and lambda certainly wouldn't help there.)