Real Problems with Python

Moshe Zadka moshez at math.huji.ac.il
Wed Feb 16 23:08:57 CET 2000


On 16 Feb 2000, [ISO-8859-1] François Pinard wrote:

> As for lexical closures, you probably mean packaging widgets into classes?
> This looks sterling to me!  But given you add:
> 
> > they want to attach small & simple procedures to oodles & oodles of
> > widgets (your "common and frequent" indeed), and out-of-line class
> > solutions are legitimately viewed as clumsier and more obscure.
> 
> I have the impression I did not understand what you meant by lexical
> closures.

Oh, but Francois, you did. I did some (though not as much as I'd like to)
Python/Tkinter programming (I even managed to get people to pay me for
that), and I strongly disagree with Tim. In Python GUIs, I learned from
Guido's IDLE, we make everything a class, and then we make the callbacks
methods. That way, they have the "context" of the class, in which to set 
arguments. This is closer to the way you do it in C (passing in self
instead of some void * pointing to a hairy structure) then the way you do
it in Scheme (doing the same thing implicitly: the equivalent to "self"
would be a scheme-ish environment, if I remember my Scheme classes
correctly).

Hence, my personal opinion on lambdas: kill them. With knives. They merely
confuse Python GUI programmers.

and-i-do-hope-esr-won't-manage-to-shoot-at-me-across-the-ocean-ly y'rs, Z.
--
Moshe Zadka <mzadka at geocities.com>. 
INTERNET: Learn what you know.
Share what you don't.





More information about the Python-list mailing list