Strange, simple Jython problem

William Sonna wsonna at attglobal.net
Thu Feb 20 19:49:48 EST 2003


On Thu, 20 Feb 2003 12:42:31 -0800, Clueless Chris wrote:

> Hi all,
> 
> I'm an experienced Java guy who's messing around with Java a little. I
> can call regular Java classes just fine, such as Math.random() to get
> a random number -- the "Hello World" of Jython programs -- but calling
> my own classes, it complains that I'm an argument short. I get syntax
> errors saying "expecting 3 args; got 2", etc etc. I assume this is a
> 'this' issue, especially since when I try giving it a 3rd arg, it
> complains that my first arg, saying "self can't be coerced to" and
> then the type of the arg I tried to pass in.
> 
> What's strange is that the normal JDK classes work fine.
> 
> What am I missing here?
> 
> Thanks,
> CC

Did you remembr to include "self" as the first parameter of your method
definitions in your classes?

As in:

class Nothing:

    def __init__(self):
        pass

j = Nothing()





More information about the Python-list mailing list