You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(6) |
Nov
(8) |
Dec
(51) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(105) |
Feb
(93) |
Mar
(194) |
Apr
(145) |
May
(100) |
Jun
(111) |
Jul
(117) |
Aug
(126) |
Sep
(233) |
Oct
(138) |
Nov
(164) |
Dec
(109) |
2002 |
Jan
(216) |
Feb
(175) |
Mar
(216) |
Apr
(194) |
May
(157) |
Jun
(140) |
Jul
(158) |
Aug
(73) |
Sep
(105) |
Oct
(164) |
Nov
(104) |
Dec
(95) |
2003 |
Jan
(72) |
Feb
(69) |
Mar
(81) |
Apr
(151) |
May
(101) |
Jun
(139) |
Jul
(99) |
Aug
(118) |
Sep
(115) |
Oct
(151) |
Nov
(161) |
Dec
(102) |
2004 |
Jan
(120) |
Feb
(175) |
Mar
(106) |
Apr
(111) |
May
(54) |
Jun
(78) |
Jul
(76) |
Aug
(105) |
Sep
(94) |
Oct
(143) |
Nov
(75) |
Dec
(85) |
2005 |
Jan
(99) |
Feb
(77) |
Mar
(164) |
Apr
(97) |
May
(79) |
Jun
(57) |
Jul
(65) |
Aug
(102) |
Sep
(95) |
Oct
(129) |
Nov
(123) |
Dec
(52) |
2006 |
Jan
(48) |
Feb
(99) |
Mar
(90) |
Apr
(51) |
May
(81) |
Jun
(136) |
Jul
(56) |
Aug
(109) |
Sep
(50) |
Oct
(44) |
Nov
(74) |
Dec
(75) |
2007 |
Jan
(92) |
Feb
(137) |
Mar
(93) |
Apr
(79) |
May
(52) |
Jun
(74) |
Jul
(143) |
Aug
(175) |
Sep
(154) |
Oct
(137) |
Nov
(88) |
Dec
(90) |
2008 |
Jan
(58) |
Feb
(113) |
Mar
(167) |
Apr
(88) |
May
(105) |
Jun
(37) |
Jul
(87) |
Aug
(72) |
Sep
(56) |
Oct
(41) |
Nov
(102) |
Dec
(70) |
2009 |
Jan
(115) |
Feb
(113) |
Mar
(126) |
Apr
(58) |
May
(125) |
Jun
(45) |
Jul
(90) |
Aug
(125) |
Sep
(84) |
Oct
(61) |
Nov
(111) |
Dec
(61) |
2010 |
Jan
(85) |
Feb
(86) |
Mar
(130) |
Apr
(58) |
May
(57) |
Jun
(32) |
Jul
(25) |
Aug
(50) |
Sep
(41) |
Oct
(65) |
Nov
(63) |
Dec
(24) |
2011 |
Jan
(43) |
Feb
(31) |
Mar
(28) |
Apr
(68) |
May
(53) |
Jun
(42) |
Jul
(58) |
Aug
(26) |
Sep
(51) |
Oct
(76) |
Nov
(60) |
Dec
(9) |
2012 |
Jan
(16) |
Feb
(32) |
Mar
(32) |
Apr
(39) |
May
(16) |
Jun
(19) |
Jul
(3) |
Aug
(11) |
Sep
(35) |
Oct
(47) |
Nov
(28) |
Dec
(18) |
2013 |
Jan
(18) |
Feb
(36) |
Mar
(10) |
Apr
(7) |
May
(7) |
Jun
(27) |
Jul
(17) |
Aug
(35) |
Sep
(19) |
Oct
(31) |
Nov
(8) |
Dec
(22) |
2014 |
Jan
(5) |
Feb
(11) |
Mar
(18) |
Apr
(23) |
May
(26) |
Jun
(14) |
Jul
(18) |
Aug
(26) |
Sep
(20) |
Oct
(48) |
Nov
(13) |
Dec
(9) |
2015 |
Jan
(9) |
Feb
(15) |
Mar
(25) |
Apr
(10) |
May
(26) |
Jun
(6) |
Jul
(13) |
Aug
(5) |
Sep
(14) |
Oct
(36) |
Nov
(24) |
Dec
(18) |
2016 |
Jan
(24) |
Feb
(11) |
Mar
(1) |
Apr
(6) |
May
(7) |
Jun
(3) |
Jul
(9) |
Aug
(15) |
Sep
(22) |
Oct
(5) |
Nov
(5) |
Dec
(2) |
2017 |
Jan
(20) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
(5) |
Jun
(7) |
Jul
(14) |
Aug
(9) |
Sep
(18) |
Oct
(2) |
Nov
(3) |
Dec
(3) |
2018 |
Jan
(7) |
Feb
(6) |
Mar
(1) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
(18) |
Sep
(8) |
Oct
(9) |
Nov
(4) |
Dec
(6) |
2019 |
Jan
(5) |
Feb
|
Mar
(2) |
Apr
(4) |
May
(6) |
Jun
(8) |
Jul
(11) |
Aug
(10) |
Sep
(6) |
Oct
|
Nov
(1) |
Dec
|
2020 |
Jan
(8) |
Feb
(3) |
Mar
(1) |
Apr
(4) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
(1) |
Oct
(5) |
Nov
(2) |
Dec
(1) |
2021 |
Jan
|
Feb
|
Mar
(5) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(7) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
(5) |
Jul
(15) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
|
Feb
(1) |
Mar
|
Apr
(2) |
May
|
Jun
(5) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: John M. <joh...@ya...> - 2001-04-04 21:54:07
|
Whew! It works now. I added jython.jar to the CLASSPATH. That makes sense based on the error msg below. I'm suprised though since I don't remember needing to do this before. For now I'm thrilled just to have the jar. Not only do I have a jar file but it also doesn't require jython.jar to run. That's great! Everything is in one jar file. --- John Mudd <joh...@ya...> wrote: > I've come up with a list of steps before trying jythonc. > 1) purge the cache directory > 2) remove all class files > 3) remove the jpywork directories & files > 4) touch all of the .py files. > Following these steps I have a different error. I seem to be closer. > > Any suggestions? > > Compiling .java to .class... > Compiling with args:['/opt/java1.3/bin/javac', ...........very > long...] > 1 ./jpywork/com/fiserv/ist/titan/repository/disk/whrandom.java:3: > package org.python.core does not exist > import org.python.core.*; > ^ > ./jpywork/com/fiserv/ist/titan/repository/disk/whrandom.java:237: > cannot resolve symbol > symbol : class PyObject > location: class com.fiserv.ist.titan.repository.disk.whrandom > public static void moduleDictInit(PyObject dict) { > ^ > ./jpywork/com/fiserv/ist/titan/repository/disk/whrandom.java:9: > cannot > resolve symbol > symbol : class PyFunctionTable > location: class > com.fiserv.ist.titan.repository.disk.whrandom._PyInner > public static class _PyInner extends PyFunctionTable implements > PyRunnable { ^ > > > __________________________________________________ > Do You Yahoo!? > Get email at your own domain with Yahoo! Mail. > http://personal.mail.yahoo.com/ > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |
From: John M. <joh...@ya...> - 2001-04-04 21:12:04
|
I've come up with a list of steps before trying jythonc. 1) purge the cache directory 2) remove all class files 3) remove the jpywork directories & files 4) touch all of the .py files. Following these steps I have a different error. I seem to be closer. Any suggestions? Compiling .java to .class... Compiling with args:['/opt/java1.3/bin/javac', ...........very long...] 1 ./jpywork/com/fiserv/ist/titan/repository/disk/whrandom.java:3: package org.python.core does not exist import org.python.core.*; ^ ./jpywork/com/fiserv/ist/titan/repository/disk/whrandom.java:237: cannot resolve symbol symbol : class PyObject location: class com.fiserv.ist.titan.repository.disk.whrandom public static void moduleDictInit(PyObject dict) { ^ ./jpywork/com/fiserv/ist/titan/repository/disk/whrandom.java:9: cannot resolve symbol symbol : class PyFunctionTable location: class com.fiserv.ist.titan.repository.disk.whrandom._PyInner public static class _PyInner extends PyFunctionTable implements PyRunnable { ^ __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |
From: <bc...@wo...> - 2001-04-04 18:55:20
|
[Kent Johnson} >At 3:42 AM -0700 4/4/01, Finn Bock wrote: >>Keep in mind that python class can't overload a method name. Instead it >>can define different numbers of arguments to the same method. > >So, if a jython class overrides a method from a Java superclass, >- The jython class can only have one implementation of the method (no >overloaded methods in Python) >- Any call to that method name, regardless of actual arguments, will >be sent to the jython method > >Is that right? Yes. >Would it be possible for the runtime to look at the >number of arguments, at least, I suppose jython could for the very common case of methods. Looking at argument count (or better looking at argument types as well as count) just strikes me as unpythonic. Keep in mind that the method could be any kind of callable and checking the argument count/types of all callables is not possible. >and look up the inheritance hierarchy to find a method match? This is what the overriden "showData" methods look like. It attempts to find a python method called "showData" and then call it if found. public void showData(test.Data arg0) { PyObject inst = Py.jfindattr(this, "showData"); if (inst != null) inst._jcall(new Object[] {arg0}); else super.showData(arg0); } public void showData(java.lang.String arg0, int arg1) { PyObject inst = Py.jfindattr(this, "showData"); if (inst != null) inst._jcall(new Object[] {arg0, Py.newInteger(arg1)}); else super.showData(arg0, arg1); } Fitting in an arg count/type match into this simple dictionary lookup is difficult. regards, finn |
From: Glen S. <gl...@en...> - 2001-04-04 18:02:47
|
---------- Forwarded Message ---------- Subject: RE: [Jython-users] overloading methods Date: Wed, 4 Apr 2001 11:44:26 -0700 From: Glen Starchman <gl...@en...> On Wed, 04 Apr 2001, Brian Zimmer wrote: > > The correct way to do this is: > > def mything(a, b, c=None): > """ do something, like check if 'c' is not None """ > if c: > print a, b, c > else: > print a, b But that begins to get complicated if you need to "overload" with several different types of parameters, doesn't it? I am not a big fan of overloading, but sometimes it is a necessary evil. I found an interesting approach with Lua for overloading (bear in mind, I don't know Lua very well and this is just my interpretation of how it works): function fn_iii(a,b,c) #takes three integers function fn_is(a,b) #takes an integer and a string function fn_ii(a,b) #takes two integers to call the function, just call fn() with the correct number of params and the runtime will analyze the params and call the appropriate function. Obviously the problem comes into play when a param is not a built-in type (eg...some random object). Not an exactly elegant solution, but it appears to work. -- c=(0x47, 0x6c, 0x65, 0x6e, 0x40, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x76, 0x65, 0x6e, 0x74, 0x75, 0x72, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d) for z in map(eval("lambda _y:_y "), range(len(c))):print repr((map( lambda q:chr(c[z]),c))).join( chr(c[z])).lower(), ------------------------------------------------------- -- c=(0x47, 0x6c, 0x65, 0x6e, 0x40, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x76, 0x65, 0x6e, 0x74, 0x75, 0x72, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d) for z in map(eval("lambda _y:-_y "), range(len(c))):print repr((map( lambda q:chr(c[z]),c))).join( chr(c[z])).lower(), |
From: Tim H. <tim...@ie...> - 2001-04-04 17:58:21
|
RE: [Jython-users] overloading methods ----- Original Message -----=20 From: Brian Zimmer=20 To: Tom Whittaker ; jyt...@li...=20 Sent: Wednesday, April 04, 2001 10:35 AM Subject: RE: [Jython-users] overloading methods The correct way to do this is:=20 def mything(a, b, c=3DNone):=20 """ do something, like check if 'c' is not None """=20 if c:=20 print a, b, c=20 else:=20 print a, b=20 You may want to be careful testing for c being true rather than testing = None specifically since: mything("spam", "eggs", []) # or () or "" or 0 or some instances. will take the second branch which may not be want you want. It's = probably better to use: def mything(a, b, c=3DNone):=20 """ do something, like check if 'c' is not None """=20 if c is not None:=20 print a, b, c=20 else:=20 print a, b=20 Pedantically yours, -tim |
From: Brian Z. <bz...@ig...> - 2001-04-04 17:35:36
|
The correct way to do this is: def mything(a, b, c=3DNone): """ do something, like check if 'c' is not None """ if c: print a, b, c else: print a, b then when you call mything with either 2 or 3 arguments the runtime figures out if 'c' should be passed, if not, it uses the default value, in this case None. mything(1, 2) - and - mything(1, 2, 3) will both work. brian -----Original Message----- From: jyt...@li... [mailto:jyt...@li...]On Behalf Of Tom Whittaker Sent: Wednesday, April 04, 2001 12:22 PM To: jyt...@li... Subject: [Jython-users] overloading methods Please pardon my basic "newbie" question...I've not been able to find the answer to this in the tutorial, in O'Reilly, or thru web searching. I am making a .py file with a bunch of methods. I'd like to overload (at least) one of them, like: def mything(a,b,c) print a,b,c def mything(a,b) print a,b What I've found is that only the last one in the .py file seems to be called every time. If I try to reference the above with: file.mything(1,2,3) I get an error message like: "not enough arguments; expected 3 got 2". I've overcome this by using a single method like: def mything(*a) and looking at the len(a). Since Jython does such a great job when trying to figure out which overloaded method to use in a Java class, I thought I must be missing something. Is there a better/preferred way to accomplish this? Thanks ahead for your advice & guidance, tom --=20 Tom Whittaker (to...@ss...) University of Wisconsin-Madison Space Science and Engineering Center Phone/VoiceMail: 608/262-2759 Fax: 608/262-5974 _______________________________________________ Jython-users mailing list Jyt...@li... http://lists.sourceforge.net/lists/listinfo/jython-users |
From: Tom W. <to...@ss...> - 2001-04-04 17:21:45
|
Please pardon my basic "newbie" question...I've not been able to find the answer to this in the tutorial, in O'Reilly, or thru web searching. I am making a .py file with a bunch of methods. I'd like to overload (at least) one of them, like: def mything(a,b,c) print a,b,c def mything(a,b) print a,b What I've found is that only the last one in the .py file seems to be called every time. If I try to reference the above with: file.mything(1,2,3) I get an error message like: "not enough arguments; expected 3 got 2". I've overcome this by using a single method like: def mything(*a) and looking at the len(a). Since Jython does such a great job when trying to figure out which overloaded method to use in a Java class, I thought I must be missing something. Is there a better/preferred way to accomplish this? Thanks ahead for your advice & guidance, tom -- Tom Whittaker (to...@ss...) University of Wisconsin-Madison Space Science and Engineering Center Phone/VoiceMail: 608/262-2759 Fax: 608/262-5974 |
From: John M. <joh...@ya...> - 2001-04-04 16:15:04
|
I decided to build a jar file and use the jython.jar with it. Now I get errors just trying to build the jar as follows. $ make jythonc --all --package com.ry.disk \ --jar ../../../../../../../classes/ry.jar hield.py nnMgr.py skServer.py skUsageThread.py leMgr.py rtSession.py stMisc.py ckMgr.py sgQueue.py skSet.py bjFile.py bjIndex.py adSession.py spy.py processing hield processing getopt processing string $ make jythonc --all --package com.ry.disk \ --jar ../../../../../../../classes/ry.jar hield.py nnMgr.py skServer.py skUsageThread.py leMgr.py rtSession.py stMisc.py ckMgr.py sgQueue.py skSet.py bjFile.py bjIndex.py adSession.py spy.py processing hield processing getopt processing string processing stMisc processing traceback processing linecache processing stat processing javaos processing javapath processing nnMgr processing skServer processing bjDiskSet processing glob Traceback (innermost last): File "/home/mudd/jython-2.1a1/Tools/jythonc/jythonc.py", line 5, in ? File "/home/mudd/jython-2.1a1/Tools/jythonc/main.py", line 300, in main File "/home/mudd/jython-2.1a1/Tools/jythonc/main.py", line 219, in doCompile File "/home/mudd/jython-2.1a1/Tools/jythonc/compile.py", line 215, in compilefile File "/home/mudd/jython-2.1a1/Tools/jythonc/compile.py", line 231, in compile File "/home/mudd/jython-2.1a1/Tools/jythonc/compile.py", line 296, in addDependencies File "/home/mudd/jython-2.1a1/Tools/jythonc/compile.py", line 215, in compilefile File "/home/mudd/jython-2.1a1/Tools/jythonc/compile.py", line 231, in compile File "/home/mudd/jython-2.1a1/Tools/jythonc/compile.py", line 296, in addDependencies File "/home/mudd/jython-2.1a1/Tools/jythonc/compile.py", line 215, in compilefile File "/home/mudd/jython-2.1a1/Tools/jythonc/compile.py", line 24, in getdata IOError: File not found - /new1/mudd/jython-2.1a1/Lib/glob.py (Too many open files) gmake2: *** [../../../../../../../classes/ry.jar] Error 255 $ FYI: The file "glob.py" does seem to be in place. I guess the "too many open files" problem prevented accessing this file. $ pwd /new1/mudd/jython-2.1a1/Lib $ ls -l glob.py -rw-r--r-- 1 mudd general 1197 Apr 4 11:49 glob.py $ The reason that the home directory used above is /home/mudd in some cases and /new1/mudd in some is because my home directory is linked from /new1 to /home. $ cd /home $ ls -l mudd lrwxr-xr-x 1 mudd general 10 Sep 21 2000 mudd -> /new1/mudd $ __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |
From: DITTGEN P. <pie...@cr...> - 2001-04-04 15:31:56
|
> > for aKey in myMap.getKeys(): > Correct is: for aKey in myMap.keys(): > or > for (aKey, aValue) in myMap.entries() > Correct is: for (aKey, aValue) in myMap.items(): Regards Pierre |
From: Kent J. <kjo...@tr...> - 2001-04-04 15:23:24
|
Is there a way for a jython program to iterate over the data in a Collection using a for loop? If I try for aKey in myMap.getKeys(): or for (aKey, aValue) in myMap.entries() I get an AttributeError on __getitem__ Do I have to explicitly use Iterators to make this work? P.S. I am using Java 1.1 collections if it matters Kent Johnson Transparent Language, Inc. kjo...@tr... http://www.transparent.com |
From: D-Man <ds...@ri...> - 2001-04-04 15:06:11
|
On Wed, Apr 04, 2001 at 11:01:51PM -0400, cindy wrote: | > The following code worked for me : | > | > from java.awt import Component , AWTEvent | > | > class C( Component ) : | > def __init__( self ) : | > self.super__enableEvents( AWTEvent.WINDOW_EVENT_MASK ) | | Ok. So this means that ever time I wanted to use this method, "enableEvents()" I | have to | inherit Component. But lets say that I would like to extend some other | component, like | JFrame. Then if I want to use enableEvents() in the same class that I want to | extend | JFrame, I would have to inherit Componet and do a composit on JFrame. Is this | correct? Not quite. If you look at the top of the documenation for JFrame you will see Class JFrame java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Window | +--java.awt.Frame | +--javax.swing.JFrame JFrame already inherits from java.awt.Component. The term "is-a" is often used with inheritance. A JFrame object is-a Component object. If you inherit from JFrame, you are indirectly inheriting from Component. If you look farther down on the documentation page you will see a list of "Methods inherited from Frame" and "Methods inherited from Window" and ... and "Methods inherited from Component". Since the methods are listed there, they exist in objects of the type "JFrame". FYI, the documentation (for JDK1.2.2) is at http://java.sun.com/products/jdk/1.2/docs/api/index.html while the JFrame page is http://java.sun.com/products/jdk/1.2/docs/api/javax/swing/JFrame.html -D |
From: Brian Z. <bz...@ig...> - 2001-04-04 15:03:59
|
( I'm perfectly comfortable being corrected when I'm wrong. ) Point well made, I'll be more careful next time ;) D-Man is indeed correct and offered a better explanation of object vs. class than I did. Sorry for any confusion and thanks for the clarification. brian -----Original Message----- From: jyt...@li... [mailto:jyt...@li...]On Behalf Of D-Man Sent: Wednesday, April 04, 2001 9:30 AM To: Jyt...@li... Subject: Re: [Jython-users] A big problem for me! ( I don't mean to be condescending at all, but I want to make sure this doesn't cause some confusion. ) An object can't be abstract, only classes can. Objects also can't be subclassed, only classes can be subclassed. Also, 'self' hasn't been "called", it was only used to access an attribute. =20 (calling it would look like self() or self( <some arguments here> ) and would require defining the function __call_ ) I think Brian knows this, but mixed a couple of terms around in writing this. Other than the wording issues, everything Brian said is accurate and (hopefully) helpful to you. -D On Tue, Apr 03, 2001 at 03:05:05PM -0500, Brian Zimmer wrote: |=20 | Wayne, | =20 | You can call "self" on an abstract object, you just can't instantiate | an abstract object. An abstract object has all the state and | behaviour of a normal, concrete object it just can't live on it's | own. It needs to be subclassed and made abstract. For a good example | of this, check out the java.io.* packages, in particular, either the | Reader/Writer or InputStream/OutputStream classes and their | subclasses. Look at FileReader and you'll notice it is an | implementation of the abstract Reader class, all FileReader provides | to Reader is how to get the initial data, in this case a File. | =20 | Python really doesn't have the notion of an abstract class, in general | an abstract class or interface is implemented by defining a bunch of | methods which raise Exceptions. | =20 | So in your case, you can't instantiate a Component, but you can get | subclasses of Component and then call methods on them. | =20 | hope this helps, | =20 | brian _______________________________________________ Jython-users mailing list Jyt...@li... http://lists.sourceforge.net/lists/listinfo/jython-users |
From: cindy <inf...@pi...> - 2001-04-04 14:58:21
|
> The following code worked for me : > > from java.awt import Component , AWTEvent > > class C( Component ) : > def __init__( self ) : > self.super__enableEvents( AWTEvent.WINDOW_EVENT_MASK ) Ok. So this means that ever time I wanted to use this method, "enableEvents()" I have to inherit Component. But lets say that I would like to extend some other component, like JFrame. Then if I want to use enableEvents() in the same class that I want to extend JFrame, I would have to inherit Componet and do a composit on JFrame. Is this correct? Thanks. Wayne |
From: D-Man <ds...@ri...> - 2001-04-04 14:31:18
|
( I don't mean to be condescending at all, but I want to make sure this doesn't cause some confusion. ) An object can't be abstract, only classes can. Objects also can't be subclassed, only classes can be subclassed. Also, 'self' hasn't been "called", it was only used to access an attribute. (calling it would look like self() or self( <some arguments here> ) and would require defining the function __call_ ) I think Brian knows this, but mixed a couple of terms around in writing this. Other than the wording issues, everything Brian said is accurate and (hopefully) helpful to you. -D On Tue, Apr 03, 2001 at 03:05:05PM -0500, Brian Zimmer wrote: | | Wayne, | | You can call "self" on an abstract object, you just can't instantiate | an abstract object. An abstract object has all the state and | behaviour of a normal, concrete object it just can't live on it's | own. It needs to be subclassed and made abstract. For a good example | of this, check out the java.io.* packages, in particular, either the | Reader/Writer or InputStream/OutputStream classes and their | subclasses. Look at FileReader and you'll notice it is an | implementation of the abstract Reader class, all FileReader provides | to Reader is how to get the initial data, in this case a File. | | Python really doesn't have the notion of an abstract class, in general | an abstract class or interface is implemented by defining a bunch of | methods which raise Exceptions. | | So in your case, you can't instantiate a Component, but you can get | subclasses of Component and then call methods on them. | | hope this helps, | | brian |
From: Kent J. <kjo...@tr...> - 2001-04-04 13:37:49
|
At 3:42 AM -0700 4/4/01, Finn Bock wrote: >Keep in mind that python class can't overload a method name. Instead it >can define different numbers of arguments to the same method. So, if a jython class overrides a method from a Java superclass, - The jython class can only have one implementation of the method (no overloaded methods in Python) - Any call to that method name, regardless of actual arguments, will be sent to the jython method Is that right? Would it be possible for the runtime to look at the number of arguments, at least, and look up the inheritance hierarchy to find a method match? Kent |
From: <bc...@wo...> - 2001-04-04 10:41:00
|
[D-Man] >So with that knowledge, a class that inherits from java.awt.Component >should have a member 'enableEvents'. The problem here is it is >'protected'. In Java that means that only subclasses and classes in >the same package can access the function. Other classes can't call >it. Apparently jython does some name mangling on protected members by >prefixing "super__" to it. (I certainly hope it is mentioned in the >documentation, but like a <ahem> genius^H^H^H^H^H^Hidiot I haven't >checked ;-)) It is mentioned in the section "Calling Methods in Your Superclass" http://www.jython.org/docs/subclassing.html regards, finn |
From: <bc...@wo...> - 2001-04-04 10:40:34
|
[Kent Johnson] >Here is a complete test case. When using the first showData in >MyCallback, it works. With the second callback (as below) it gives > >Traceback (innermost last): > File "<console>", line 1, in ? > File "./Project/Test.py", line 12, in ? >TypeError: showData() takes at least 3 arguments (2 given) Keep in mind that python class can't overload a method name. Instead it can define different numbers of arguments to the same method. Since the python "showData" method will subclass both java showData methods, you will have to figure out which invocation that occured. Something like: def showData(self, inName, inValue=None): if inValue == None: # The "inName" arg is actually a Data instance Test.Callback.showData(self, inName) else: print inName print inValue As you can see, implementing an overloaded java method in python is not a situation where jython shines. regards, finn |
From: <bc...@wo...> - 2001-04-04 10:40:06
|
On Mon, 2 Apr 2001 16:40:40 -0500 (CDT), you wrote: >Hello all, > >I have a question about the builtins chr(). The Python Library >Reference for 2.1b2 says it "Return a string of one character whose ASCII >code is the integer i, e.g., chr(97) returns the string 'a'. This is the >inverse of ord(). The argument must be in the range [0..255], inclusive; >ValueError will be raised if i is outside that range." > >When interpreting this for Jython, the obvious catches are that it >specifies "range [0..255]", and raises ValueError for i outsite this >range. > >This doesn't really seem to apply considering how Jython only has the >2-byte character string. Different behavior for Jython's builtin chr() >makes sense. However, is this difference in chr() official? I think it is. As long as CPython strings are 8-bits, I expect this difference to stand. >I didn't >see a comment on http://jython.sourceforge.net/docs/differences.html about >this, I'll add an item about the chr() difference. >and I wanted to be sure before committing it to paper for a Jython >publication (and risking a ValueError being raised in Jython2.1final or >2.2). It will not throw ValueErrors for 2.1 final. The string/unicode split in CPython is not pleasing and will perhaps change in later versions of CPython. If ever that happens, Jython may change too, but only in order to reduce the differences between the two implementations. regards, finn |
From: <bc...@wo...> - 2001-04-04 10:38:57
|
[Pierre Dittgen] >I'm quite new to jython, i find it very powerful as a script language. >But at this time, I have a problem to make an independant jar from a jython >script. >I use Jython 2.0, with SUN JDK1.3.0 on Win2000 Pro. > >My script is called dir.py and contains: >== begin ====== >import os > >for file in os.listdir('.'): > print file >== end ======== > >It works well as I use the command line: >jython dir.py >(it shows me the list of the files of the current directory) > >I want to build a jar file from this script. >I used this command : >jythonc -a -j dir.jar dir.py >It created a jar file (called dir.jar) which contains normally all the >needed jython libraries >needed to make it run. >But as I want to run it, using the command >java -jar dir.jar >I got an exception : >== begin ============== > >java.lang.ExceptionInInitializerError: java.lang.NullPointerException > at org.python.modules.os.<clinit>(os.java:11) It is a bug in the os.java module when running without an unset sys.prefix. This normally happens for jythonc compiled applications. As a workaround, you can set sys.prefix before importing the "os" module. import sys; sys.prefix = "." import os ... or you can upgrade to Jython-2.1a1 where the bug is fixed. >I solved the problem giving the root dir of jython installation as a system >property: >java -Dpython.home=c:\dev\jython-2.0 -jar dir.jar > >But it annoys me... >Is the generated jar (dir.jar) still dependant of the jython installation ? No. regards, finn |
From: DITTGEN P. <pie...@cr...> - 2001-04-04 10:02:57
|
> > Now this means that your app will have to ship some python > files in the JAR. It annoyed me quite much and I looked further in the code (in org.python.modules.os). Before the line that causes me trouble, i.e. this: public static String __file__ = Py.getSystemState().prefix.toString() + "/Lib/javaos.py"; there is a comment saying: // An ugly hack, but it keeps the site.py from CPython2.0 happy So, apparently, it's just a hack, that's not used at runtime... BUT, this hack requires the 'python.home' system property to be set.. So, i just tried to declare it and it works! my example runs now with: java -Dpython.home= -jar dir.jar (dir.jar was created using --all option to include all jython libs useful for my app) It won't be very difficult to set this empty property at deployment time, in any case easier than installing a jython distrib on the host machine. Thanks for the help Pierre |
From: Ben H. <Ben...@fi...> - 2001-04-04 09:41:23
|
----- Original Message ----- From: "DITTGEN Pierre" <pie...@cr...> > The code at line 11 in os.java is: > > public static String __file__ = > Py.getSystemState().prefix.toString() + "/Lib/javaos.py"; > > Is getSystemState() method returning a null value? > Is prefix attribute null? Definitely one of the above. Clearly the above line sets a file path to javaos.py, presumably relative to a base JPython directory set by -Dpython.home=c:\dev\jython-2.0. When the property isnt set Jython fails. > > But why, is there a reference to javaos.py? > Do I need the jython libs as jython scripts (i.e. not as class files) > to make my prog run? My understanding is that Jython consists of both a java core interpreter and multiple modules written in python. This is a good thing: it enables Jython to provide that same Python infrastructure that CPython presents, and it tests/proves that the core interpreter is python complaint. Now this means that your app will have to ship some python files in the JAR. They are too big so this shouldnt be a problem. You just need to devise a way to set 'python.home' in your deployment. What you want is an absolute URL to the JAR you are packed in, on the host machine, because the location of .py files is fixed and relative to that. I dont know if anyone has already solved this one finally for Jython. What I would do is use the *useful* Classloader.getSystemResource(String resource) method. This can take the relative name of a file, which it will search for in all the roots of its classpath, and return you an absolute URL locating the file. Additionally, you could look at Bruce Eckels "Thinking in Patterns", which is free online and has some useful advanced Jython examples in the Interpreter chapter. Regards Ben |
From: John M. <joh...@ya...> - 2001-04-04 04:01:51
|
I switched to the latest jython but I still get an error when trying to run a jythonc generated jar file unless I put the jython.jar in the CLASSPATH. I used the "--all" option when running jythonc. Any suggestions. In this case yyy is a valid attribute for a super class that was inherited by xxx. This works when run as a jython script. It only works as a jythonc jar file if I put jython.jar in the CLASSPATH. AttributeError: instance of 'xxx' has no attribute 'yyy' $ jython Jython 2.1a1 on javaVM-1.3.0.01 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |
From: cindy <inf...@pi...> - 2001-04-03 20:12:50
|
Thanks for your time! I went the jython site and found the documentation. the documentation has more meaning for me now, now that I had the problem. Wayne > prefixing "super__" to it. (I certainly hope it is mentioned in the > documentation, but like a <ahem> genius^H^H^H^H^H^Hidiot I haven't > checked ;-)) > |
From: Brian Z. <bz...@ig...> - 2001-04-03 20:04:53
|
Wayne, You can call "self" on an abstract object, you just can't instantiate an abstract object. An abstract object has all the state and behaviour of a normal, concrete object it just can't live on it's own. It needs to be subclassed and made abstract. For a good example of this, check out the java.io.* packages, in particular, either the Reader/Writer or InputStream/OutputStream classes and their subclasses. Look at FileReader and you'll notice it is an implementation of the abstract Reader class, all FileReader provides to Reader is how to get the initial data, in this case a File. Python really doesn't have the notion of an abstract class, in general an abstract class or interface is implemented by defining a bunch of methods which raise Exceptions. So in your case, you can't instantiate a Component, but you can get subclasses of Component and then call methods on them. hope this helps, brian -----Original Message----- From: jyt...@li... [mailto:jyt...@li...]On Behalf Of cindy Sent: Wednesday, April 04, 2001 3:48 AM To: D-Man Cc: Jyt...@li... Subject: Re: [Jython-users] A big problem for me! D-Man wrote: > class Foo : > def func( self ) : > print "func was called" > > def runme( self ) : > func() # this won't work as you've seen in your code > > def runme2( self ) : > self.func() # this will work as expected This I undertstand, but I don't see how "self" can be used on a class that is inherited and that is abstract, such as Component. When I do "self.enableEvents(java.awt.event.WindowEvent.WINDOW_EVENT_MASK)" I get an AttribueError on enableEvents, which I would expect. Thanks. Wayne _______________________________________________ Jython-users mailing list Jyt...@li... http://lists.sourceforge.net/lists/listinfo/jython-users |
From: cindy <inf...@pi...> - 2001-04-03 19:44:45
|
D-Man wrote: > class Foo : > def func( self ) : > print "func was called" > > def runme( self ) : > func() # this won't work as you've seen in your code > > def runme2( self ) : > self.func() # this will work as expected This I undertstand, but I don't see how "self" can be used on a class that is inherited and that is abstract, such as Component. When I do "self.enableEvents(java.awt.event.WindowEvent.WINDOW_EVENT_MASK)" I get an AttribueError on enableEvents, which I would expect. Thanks. Wayne |