Martin Franklin a écrit :
Tim Daneliuk wrote:

In-Reply-To: <[EMAIL PROTECTED]>
(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.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to