Inner classes

James_Althoff at i2.com James_Althoff at i2.com
Fri Jun 15 21:28:58 CEST 2001


Samuele Pedroni wrote:
>I hope you know that you can do the following in jython:
>
>class StupidExample:
>
> def butAAction(self,e):
>   ....
>
> def butBAction(sel,e):
>   ...
>
> def __init__(self):
>   self.butA = JButton("A",actionPerformed=self.butAAction);
>   self.butB = JButton("B",actionPerformed=self.butBAction);
>
>or even lambdas instead of bounded methods if your code is short enough
>
><wink> Samuele Pedroni.

Absolutely.  We have done a couple hundred thousand lines of Jython/Swing
code here and the idiom above is one of our favorites!

Jython Rocks!

Jim






More information about the Python-list mailing list