Sorry, I wasn't clear enough. In python one can write code like this:
def _setspam(self, value):
self._spam = value
geteggs = staticmethod(geteggs)
spam = property(_getspam, _setspam)
if __name__ == "__main__":
f = Food()
f.spam = "spam"
I was wondering if it is possible to get the same behavior under jython. But
then this is more of a python question than a jython one.
>From: Ype Kingma <ykingma@...>
>To: "Rodrigo B. de Oliveira" <rodrigobamboo@...>, "jython-users"
>Subject: Re: [Jython-users] staticmethod and property
>Date: Tue, 22 Oct 2002 20:01:56 +0200
>On Tuesday 22 October 2002 15:32, Rodrigo B. de Oliveira wrote:
> > Is there a way to emulate those with jython?
>Static method: function defined at module scope,
>call the java code for properties directly from jython.
MSN Hotmail, o maior webmail do Brasil. http://www.hotmail.com
On Tuesday 22 October 2002 20:27, Rodrigo Oliveira wrote:
> >Have these things been introduced in python 2.2?
Then you'll have to wait for jython 2.2. See recent discussions
on jython-dev on that subject.
On Tuesday 22 October 2002 20:04, Rodrigo Oliveira wrote:
> Sorry, I wasn't clear enough. In python one can write code like this:
> <snip language=3D"python">
> class Food:
> def _getspam(self):
> return self._spam
> def _setspam(self, value):
> self._spam =3D value
> def geteggs():
> return "eggs"
> geteggs =3D staticmethod(geteggs)
> spam =3D property(_getspam, _setspam)
> if __name__ =3D=3D "__main__":
> f =3D Food()
> f.spam =3D "spam"
> print Food.geteggs()
> I was wondering if it is possible to get the same behavior under jython=
> But then this is more of a python question than a jython one.
How do you get this behaviour in python 2.1?
I get NameErrors for both 'staticmethod' and 'property'
in both jython 2.1 and python 2.1.
Have these things been introduced in python 2.2?