Python becoming less Lisp-like
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Tue Mar 15 16:55:48 EST 2005
Martin Franklin a écrit :
> Tim Daneliuk wrote:
>
>> In-Reply-To: <slrnd3da07.v6h.nick at irishsea.home.craig-wood.com>
(snip)
>>> Of course we users will complain about removals, but we'll knuckle
>>> down and take our medicine eventually ;-)
>>
>> Except that in this case, removal will also complicate code in some
>> cases. Consider this fragment of Tkinter logic:
>>
>> UI.CmdBtn.menu.add_command(label="MyLabel",
>> command=lambda cmd=cmdkey:
>> CommandMenuSelection(cmd))
>>
>
> In this case you perhaps should try using a class like so:-
>
> UI.CmdBtn.menu.add_command(label="MyLabel",
> command=CommandMenuSelectionCallback(cmdkey))
>
> Where CommandMenuSelectionCallback is a class like so:
>
> class CommandMenuSelectionCallback:
> def __init__(self, key):
> self.key = key
>
> def __call__(self):
> print self.key
Looks like Java.
More information about the Python-list
mailing list