REPOST: Re: Python becoming less Lisp-like

Ville Vainio ville at spammers.com
Thu Mar 17 11:39:54 EST 2005


>>>>> "Tim" == Tim Daneliuk <tundra at tundraware.com> writes:

    Tim> Except that in this case, removal will also complicate code
    Tim> in some cases.  Consider this fragment of Tkinter logic:

    Tim> UI.CmdBtn.menu.add_command(label="MyLabel",
    Tim> command=lambda cmd=cmdkey: CommandMenuSelection(cmd))

    Tim> Would it not be the case that, without lambda, we will need
    Tim> to pollute the name space with a bunch of specialized little
    Tim> functions for each and every construct like this?

You can reuse the same name for all those little functions to avoid
polluting the namespace. Choose 'L' if it gives you that cozy
lambda-ish feel.

-- 
Ville Vainio   http://tinyurl.com/2prnb



More information about the Python-list mailing list