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: Donatas S. <do...@no...> - 2001-02-01 06:57:16
|
I tried to use jTkinter under linux, it compiles but with warnings, but i newer got it working. So i was forced to use vim or jedit. On Thursday 01 February 2001 07:12, Jarek Sacha wrote: > Would it be possible to use IDLE with jython? This probably requires > jTkinter, does it work with jython? > What do you use to prototype and debug in jython? > > Jarek > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users -- Donatas Simkunas |
From: Jarek S. <ja...@ie...> - 2001-02-01 05:14:24
|
Would it be possible to use IDLE with jython? This probably requires jTkinter, does it work with jython? What do you use to prototype and debug in jython? Jarek |
From: Brian Z. <bri...@ya...> - 2001-01-31 17:34:39
|
Hello list, Following http://groups.yahoo.com/group/jpython/message/3714 I succeeded making servlet running under PyServlet wrapper/handler on win2k tomcat3.2.1. So far so good, I can run simple script like: import sys, java, javax class hello(javax.servlet.http.HttpServlet): def doGet(self, req, res): res.setContentType("text/html"); out = res.getOutputStream() out.println("""\ <html> <head><title>Hello World</title></head> <body>Hello World! <P> current server time is: %s </P> </body> </html> """ % (java.util.Date())) out.close() return Or even dynamicly generate PNG graph thanks to the new javax.imagio package from Sun. I don't expect any difficulty hooking up with database using JDBC. However, when trying to port SnoopServlet from java to jython, I found that PyServlet really doesn't handover any instant variables to the jython HttpServlet subclass except (request, response). So enum = self.getInitParameterNames() will got a NullPointerException. Any operation involve self.attribute like self.getServletContext() will also fail. I don't think jythonc compiled classes will have this problem because the jython servlet handle service() directly bypassing PyServlet. So my questions are: 1. Am I missing anything? Any misunderstanding of the API? 2. Any way around? Anyone got a better PyServlet? 3. If I'm the first one got bitten, any idea how we may overcome this problem? Seeing the power of dynamic python scripting at work (instant feedback without re-compiling), I really appreciate what have been done so far, and want to get it going. Here are some of my ideas: 1. We can have two seperate subclasses of HttpServlet in java: one possibly named ServletPyHandler, doing what PyServlet currently is doing, dispatching service() calls to jython servlet; the other JyServlet being superclass of all jython servlets, with constructor JyServlet(ServletPyHandler), so JyServlet always has a ref to the ServletPyHandler instance; The downside of this approach is that now jythonc compiled servlet and dynamically interpreted servlet have to be written differently. 2. Have ServletPyHandler do somthing to the jython servlet class right before dispatching service() call, so that inside jython servlet, later when messages like self.getInitParameterNames() will be redirected back to ServletPyHandler. TIA for any ideas, /Brian |
From: <bc...@wo...> - 2001-01-31 09:44:13
|
[Darrell Gallion] >Thought I'd give Jython a try and got stuck on the demo. > >Taking this command line from the doc didn't work. >It used the '*' and tries to process that. >E:\Java\jython-2.0\Demo\applet>jythonc --core --deep --jar appletdemo.jar >*.py >processing * > >So I feed it one filename, it produced no output. >E:\Java\jython-2.0\Demo\applet>jythonc --core --deep --jar appletdemo.jar >ButtonDemo.py >processing ButtonDemo > >This story becomes more sad and complex as I tried to fix jythonc to handle >the *.py >By using glob.glob, no need to share that pain :) > >Any pointers? I guess you are using jview? I have never managed to use jythonc with jview, the lack of glob is the least of the problems that you will encounter. You will be far better of by switching to javasoft's SDK. If you want to make applets you will need a JDK1.1: http://www.javasoft.com/products/jdk/1.1/ If not, you will be better off with the lastest SDK: http://www.javasoft.com/j2se/1.3/ regards, finn |
From: Darrell G. <da...@do...> - 2001-01-31 03:48:42
|
Thought I'd give Jython a try and got stuck on the demo. Taking this command line from the doc didn't work. It used the '*' and tries to process that. E:\Java\jython-2.0\Demo\applet>jythonc --core --deep --jar appletdemo.jar *.py processing * So I feed it one filename, it produced no output. E:\Java\jython-2.0\Demo\applet>jythonc --core --deep --jar appletdemo.jar ButtonDemo.py processing ButtonDemo This story becomes more sad and complex as I tried to fix jythonc to handle the *.py By using glob.glob, no need to share that pain :) Any pointers? --Darrell |
From: Benjamin C. <bc...@cs...> - 2001-01-30 18:18:57
|
http://sourceforge.net/projects/expectpy/ ben On Tue, 30 Jan 2001, Chris Atkins wrote: > Does anyone know of a python package which is simular to Expect for Tcl? > > Expect is a tool for automating interactive applications such as telnet, > ftp, passwd, fsck, rlogin, tip, etc. > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users > |
From: Chris A. <at...@nm...> - 2001-01-30 16:39:54
|
Does anyone know of a python package which is simular to Expect for Tcl? Expect is a tool for automating interactive applications such as telnet, ftp, passwd, fsck, rlogin, tip, etc. |
From: <bc...@wo...> - 2001-01-30 10:46:24
|
[Will] >I have run into some surprising behavior of Java Integer objects while using >jython: ><example snipped> >What am I doing wrong? How can I keep Integer and Double objects from being >converted to Java primitives? [Finn] > You can't. The eagerness with which Jython converts the java.lang.* > wrapper classes to instances of native python classes have been > discussed previousely: > > http://mail.python.org/pipermail/jpython-interest/1999-December/002590.html [Ben Hutchison] >My main concern is: will this obstruct the use of Java APIs which require Boolean >parameters? In the example William gives the expected method is not invoked. Will >developers using Jython to script or integrate existing Java systems encounter >problems; either hard to find bugs, or method signatures that cant be invoked? > >> It is basicly the same problem you have re-discovered. I'm still not >> convinved that it is a net win to reduce this eagerness. >> >> http://mail.python.org/pipermail/jpython-interest/1999-December/002596.html > >From the above article, Finn Bock wrote: > > One of the downsides of this patch, is that the simple if statement > below will no longer work. I am afraid to think about the > incompabilities this change will introduce in existing jpython > programs. > > if not lang.Boolean.FALSE: > print "FALSE" > >Equivalently, the statement below is not legal Java. So? <0.7 wink> >Is there need to support semantics that arent in Java? Yes. One of the problem, as I see it, is that we can evaluate the booleaness of a lot of objects. Testing lists and dicts are done all the time: l = ['a'] if l: print "list is not empty" Since that is possible, common sense dictate that testing a j.l.Boolean in an "if" statement should actually test the value the Boolean is wrapping. The same extends to arithmetic on j.l.Number subclasses, where is should still be possible to add a j.l.Short and 42 together. >I cant imagine many developers using expressions >similar to above, since they couldnt in Java anyway. > > if (! Boolean.FALSE) {} This lack of flexibility in java will not convince me that jython don't need it either <wink>. I said that I will not spearhead this change. I think jython can be modified in such a way that the wrapper objects are keept as java objects but still maintain their usefullness when used from a python script. It's just not something I will do. >As I understand the issues, I *think* I prefer a less eager conversion policy, >but would be happy to hear more counter-arguments. I would be more happy to see a patch <wink>. regards, finn |
From: Chris A. <at...@nm...> - 2001-01-30 09:25:03
|
I am having problems throwing a java exception from my jython code and catching it in java. I have the following class structure: SomeIF.java ^ | SomeImpl.java SomeIF.java ^ | BaseImpl -- python class ^ | SpecificImpl - python class BaseImpl looks like the following: class BaseImpl(SomeIF): def __init__(self): pass def prehook(self, arg1, arg2): raise JException(arg2, "msg") def posthook(self, arg1, arg2): return None when BaseImpl.prehook() is called, my java code gets the exception as a JException. Specificmpl looks like the following: class SpecificImpl(BaseImpl): def __init__(self): pass def prehook(self, arg1, arg2): raise JException(arg2, "msg") when SpecificImpl.prehook() is called, my java code gets org.python.core.PyException Just for grins, I placed BaseImpl and SpecificImpl in the same module. Both exceptions are caught by the same method which has the following code: public void extest(SomeIF impl) { try { impl.foo(); } catch(Exception e) { System.out.println(e.getClass().getName()); } } I am creating the instances of BaseSomeImpl and SpecificSomeImpl in the jython interpreter and passing them to my java code. Any thoughts on what might be wrong? Thanks, Chris |
From: Brian S. <br...@mb...> - 2001-01-30 00:51:51
|
I'm trying to issue commands to the underlying OS from jython 2.0 using the commands module. (I apologize if I'm mixing up some terminology here...I'm very new to Python) The catch is that the method 'popen' seems to be missing. Here's a transcript of my session: >>> import commands >>> commands.getoutput('ls') Traceback (innermost last): File "<console>", line 1, in ? File "/u/brian/apps/jython-20/Lib/commands.py", line 42, in getoutput File "/u/brian/apps/jython-20/Lib/commands.py", line 51, in getstatusoutput AttributeError: class 'org.python.modules.os' has no attribute 'popen' Is this a bug or am I missing something? If it's a bug does someone have a workaround/fix? Thanks in advance -- B ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Brian Schlining Research Technician Monterey Bay Aquarium Research Institute br...@mb... (831) 775-1855 http://www.mbari.org/~brian ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
From: Ben H. <be...@in...> - 2001-01-30 00:18:08
|
Finn Bock wrote: > [Will] > >I have run into some surprising behavior of Java Integer objects while using > >jython: > <example snipped> > >What am I doing wrong? How can I keep Integer and Double objects from being > >converted to Java primitives? > > You can't. The eagerness with which Jython converts the java.lang.* > wrapper classes to instances of native python classes have been > discussed previousely: > > http://mail.python.org/pipermail/jpython-interest/1999-December/002590.html My main concern is: will this obstruct the use of Java APIs which require Boolean parameters? In the example William gives the expected method is not invoked. Will developers using Jython to script or integrate existing Java systems encounter problems; either hard to find bugs, or method signatures that cant be invoked? > It is basicly the same problem you have re-discovered. I'm still not > convinved that it is a net win to reduce this eagerness. > > http://mail.python.org/pipermail/jpython-interest/1999-December/002596.html From the above article, Finn Bock wrote: One of the downsides of this patch, is that the simple if statement below will no longer work. I am afraid to think about the incompabilities this change will introduce in existing jpython programs. if not lang.Boolean.FALSE: print "FALSE" Equivalently, the statement below is not legal Java. Is there need to support semantics that arent in Java? I cant imagine many developers using expressions similar to above, since they couldnt in Java anyway. if (! Boolean.FALSE) {} As I understand the issues, I *think* I prefer a less eager conversion policy, but would be happy to hear more counter-arguments. Regards Ben -- Ben Hutchison Software Engineer-Market Predictor Webmind Australia http://www.webmind.com/productspredictor.html |
From: Ype K. <yk...@xs...> - 2001-01-29 22:47:02
|
""" stringbuffer.py: mutable string built on java.lang.StringBuffer. The idea is to save as many string object creations as possible while still be about as fast as string's, when implemented in Java. This python module is intended as a prototype. The itch: I needed java.lang.StringBuffer functionality in jython on the receiving side of a socket. I grew tired of writing: buf += sock.recv(maxSize) which creates a new buf everytime sock.recv(maxSize) is called. Note that sock.recv() may return as little as it likes, depending on network traffic conditions. The alternative of keeping a list of received strings did not really appeal to me. The questions: - This may have been done umpteen times before, when so could someone please tell me? - I added the standard string methods. Only when these originally return a string I have them put the result back into the stringbuffer. Methods that return something else work as if they were used on a string. Is this the right approach? Esp. for split() and friends? - I don't know whether I handled python default arguments correctly, eg: def count(self, sub, start = None, end = None): if start == None: if end == None: return str(self).count(sub) else: return str(self).count(sub, 0, end) elif end == None: return str(self).count(sub, start) else: return str(self).count(sub, start, end) (str(self) should disappear in the java version ...) - Is an extend() method needed? It is marked as experimental in my python 2.0 documentation. - Should slicing be allowed with other steps than 1? - pop() also works for slices, is that ok.? Aside: in the sort() method this line gives an internal compiler error: l = [self[i] for i in range(len(self))] # internal compiler error: name i (jython2.0a3) Why? """ """ See PEP 203 for the methods to emulate the operators += and *= : __iadd__ and __imul__. Limitations: - Slicing should be done with step 1, and no extended slicing is provided (how should this be done?). - Many methods still create string objects, by using str(self). In java charAt() and getChars() can be used instead. - Sorting has no compare function yet. Not yet tested: - insert() - *= - lots more: test_string.py could be used, adapting the test function to look up the result in the stringbuffer itself where appropriate. From the Jython faq: 5.1. Java classes that emulate Jython Dictionaries and Sequences In order to emulate Dictionaries and Sequences, first your Java class must "extend" the org.python.core.PyObject class. The following methods can then be defined on your class in order to emulate these basic Jython types: public PyObject __finditem__(PyObject key); public void __setitem__(PyObject key, PyObject value); public void __delitem__(PyObject key); Additionally, you might want to throw the org.python.core.Py.KeyError object if you have any exceptions (Note, you need not declare the Java method as throwing anything.) """ from java.lang import StringBuffer from java.lang import String from org.python.core import PySlice from org.python.core import PyList # sort from PyList doesn't work. class stringbuffer: """ basic customization """ def __init__(self, s = None): if s == None: self.sb = StringBuffer() else: self.sb = StringBuffer(s) def dump(self): print self.sb.__class__, '<' + str(self) + '>' def __repr__(self): # repr(sb) return 'stringbuffer(' + repr(str(self)) + ')' def __str__(self): # str(sb) return self.sb.toString() # java.lang.StringBuffer.toString() def __len__(self): return self.sb.length() def __nonzero__(self): return self.sb.length() > 0 """ sequence type customization """ def ji(self, i): # java index if i < 0: return i + self.sb.length() else: return i def sliceJavaDefaults(self, sl): assert sl.step == 1 if sl.start == None: b = 0 else: b = self.ji(sl.start) if sl.stop == None: e = self.sb.length() else: e = self.ji(sl.stop) return b, e def __getitem__(self, i): # self[i], key may be slice if not isinstance(i, PySlice): return self.sb.charAt(self.ji(i)) else: b, e = self.sliceJavaDefaults(i) return self.sb.substring(b, e) def __setitem__(self, i, c): # self[i] = c, key may be slice if not isinstance(i, PySlice): self.sb.setCharAt(self.ji(i), c) else: b, e = self.sliceJavaDefaults(i) self.sb.replace(b, e, c) def __delitem__(self, i): # del self[i], key may be slice if not isinstance(i, PySlice): self.sb.deleteCharAt(self.ji(i)) else: b, e = self.sliceJavaDefaults(i) self.sb.delete(b, e) def min(self): return min(str(self)) def max(self): return max(str(self)) """ `numeric' operators, most can be left to string/String """ def __add__(self, s2): # self + s2 sum = stringbuffer(str(self)) sum.append(s2) return sum def __radd__(self, s2): # s2 + self sbf = stringbuffer(str(s)) sbf.append(self.sb) return sbf def __iadd__(self, s2): # self += s2 self.append(s2) return self def __mul__(self, i): # self * i return stringbuffer(str(self) * i) def __rmul__(self, i): # i * self return stringbuffer(str(self) * i) def __imul__(self, i): # self *= i # see PyString.java for better stuff. if i > 1: self.append(str(self) * (i - 1)) elif i == 0: del self[:] return self """ methods that must be provided for mutable sequences """ def append(self, s): self.sb.append(str(s)) """ Does append() need an ensureCapacity()? In python append() is meant for single elements, but python does not have the character type. This append() works for any argument that can be str()'d. """ def count(self, sub, start = None, end = None): """ nested if testing 4 cases: ok? """ if start == None: if end == None: return str(self).count(sub) else: return str(self).count(sub, 0, end) elif end == None: return str(self).count(sub, start) else: return str(self).count(sub, start, end) def index(self, sub, start = None, end = None): if start == None: if end == None: return str(self).index(sub) else: return str(self).index(sub, 0, end) elif end == None: return str(self).index(sub, start) else: return str(self).index(sub, start, end) def pop(self, i = None): # also works for slices if i == None: i = -1 """ inlined: c = self.__getitem__(i) self.__delitem__(i) """ if not isinstance(i, PySlice): jvi = self.ji(i) c = self.sb.charAt(jvi) self.sb.deleteCharAt(jvi) else: b, e = self.provideSliceDefaults(i) c = self.sb.substring(b, e) self.sb.delete(b, e) return c def remove(self, c): # remove first occurrence of string c i = self.index(c) # raises ValueError lc = len(c) if lc == 1: self.sb.deleteCharAt(i) else: self.sb.delete(i, i + lc) def sort(self): # sort the chars standard order, no compare function yet """ a long detour via the other mutable sequence """ # l = [self[i] for i in range(len(self))] # internal compiler error: name i (jython2.0a3) l = [] for i in range(len(self)): l.append(self[i]) l.sort() self.sb = StringBuffer(''.join(l)) def reverse(self): self.sb.reverse() """ remaining java StringBuffer methods """ def extend(self, s): self.append(s) # still experimental in python? def capacity(self): return self.sb.capacity() def ensureCapacity(self, cap): return self.sb.ensureCapacity(cap) """ superfluous: use of StringBuffer.insert() """ def setLength(self, newLength): self.sb.setLength(newLength) # truncate or add null chars. """ Almost all python string methods are also useful for stringbuffers. These are probably better implemented by getting inspiration from PyString.java. Straightforward adapting to putting the result back will do in most of the cases... """ def capitalize(self): self.sb = StringBuffer(str(self).capitalize()) def center(self): self.sb = StringBuffer(str(self).center()) def endswith(self, suffix, start = None, end = None): if start == None: if end == None: return str(self).endswith(sub) else: return str(self).endswith(sub, 0, end) elif end == None: return str(self).endswith(sub, start) else: return str(self).endswith(sub, start, end) def expandtabs(self, suffix, start = None, end = None): if start == None: if end == None: self.sb = StringBuffer(str(self).expandtabs(suffix)) else: self.sb = StringBuffer(str(self).expandtabs(suffix, 0, end)) elif end == None: self.sb = StringBuffer(str(self).expandtabs(suffix, start)) else: self.sb = StringBuffer(str(self).expandtabs(suffix, start, end)) def find(self, sub, start = None, end = None): if start == None: if end == None: return str(self).find(sub) else: return str(self).find(sub, 0, end) elif end == None: return str(self).find(sub, start) else: return str(self).find(sub, start, end) def isalnum(self): return str(self).isalnum() def isalpha(self): return str(self).isalpha() def isdigit(self): return str(self).isdigit() def islower(self): return str(self).islower() def isspace(self): return str(self).isspace() def istitle(self): return str(self).istitle() def isupper(self): return str(self).isupper() def isupper(self, seq): return str(self).join(seq) def join(self, seq): return str(self).join(seq) def ljust(self): self.sb = StringBuffer(str(self).ljust()) def lower(self): self.sb = StringBuffer(str(self).lower()) def lstrip(self): self.sb = StringBuffer(str(self).lstrip()) def replace(old,new,maxsplit = None): if maxsplit == None: self.sb = StringBuffer(str(self).replace(old,new)) else: self.sb = StringBuffer(str(self).replace(old,new,maxsplit)) def rfind(self, sub, start = None, end = None): if start == None: if end == None: return str(self).rfind(sub) else: return str(self).rfind(sub, 0, end) elif end == None: return str(self).rfind(sub, start) else: return str(self).rfind(sub, start, end) def rindex(self, sub, start = None, end = None): if start == None: if end == None: return str(self).rindex(sub) else: return str(self).rindex(sub, 0, end) elif end == None: return str(self).rindex(sub, start) else: return str(self).rindex(sub, start, end) def rjust(self): self.sb = StringBuffer(str(self).rjust()) def rstrip(self): self.sb = StringBuffer(str(self).rstrip()) def split(self, sep, maxsplit = None): # returns a list of strings, not stringbuffers if maxsplit == None: return str(self).split(sep) else: return str(self).split(sep, maxsplit) def splitlines(self, keepends = None): # returns a list of strings, not stringbuffers if keepends == None: return str(self).splitlines(sep) else: return str(self).splitlines(sep, keepends) def startswith(self, suffix, start = None, end = None): if start == None: if end == None: return str(self).startswith(sub) else: return str(self).startswith(sub, 0, end) elif end == None: return str(self).startswith(sub, start) else: return str(self).startswith(sub, start, end) def strip(self): self.sb = StringBuffer(str(self).strip()) def swapcase(self): self.sb = StringBuffer(str(self).swapcase()) def title(self): self.sb = StringBuffer(str(self).title()) def translate(self, table, deletechars = None): if deletechars == None: self.sb = StringBuffer(str(self).translate(table)) else: self.sb = StringBuffer(str(self).translate(table, deletechars)) def upper(self): self.sb = StringBuffer(str(self).upper()) if __name__ == '__main__': # some initial tests, all empty strings sb1 = stringbuffer() assert not sb1 assert len(sb1) == 0 assert str(sb1) == '' assert sb1[:0] == '' assert str(sb1 + sb1) == '' sb2 = stringbuffer() sb2 += sb1 assert not sb2 sb2 += '' assert len(sb2) == 0 sb2.append(sb1) assert len(sb2) == 0 # two non empty strings, indexing and slicing, __getitem__ s1 = 'a' s2 = 'bc' sb1 = stringbuffer(s1) assert len(sb1) == len(s1) sb2 = stringbuffer(s2) assert len(sb2) == len(s2) sb1 += s2 assert str(sb1) == (s1 + s2) assert sb1[:len(s1)] == s1 assert sb1[len(s1):] == s2 assert sb1[0] == s1[0] assert sb1[1] == s2[0] assert sb1[2] == s2[1] assert sb1[1:3] == s2 assert sb1[:] == (s1 + s2) # __setitem__ sb1 = stringbuffer(3) sb2 = sb1 sb1.setLength(3) # now three null chars assert sb1[:] == '\0\0\0' assert len(sb1) == 3 sb1[0] = 'a' sb1[1] = 'b' sb1[2] = 'c' assert sb1 is sb2 # check mutability assert sb1[:] == 'abc' sb1[1] = 'd' assert sb1[:] == 'adc' assert sb1 is sb2 sb1[0:2] = 'de' assert sb1[:] == 'dec' sb1[2:2] = 'f' assert sb1[:] == 'defc' sb1 = stringbuffer('ghij') sb2 = sb1 del sb1[0] assert sb1[:] == 'hij' assert sb1 is sb2 # __delitem__ sb1 = stringbuffer('ghij') sb2 = sb1 del sb1[1:3] assert sb1[:] == 'gj' assert sb1 is sb2 # reverse sb1 = stringbuffer('ghij') sb2 = sb1 sb1.reverse() assert sb1[:] == 'jihg' assert sb1 is sb2 # negative indexes assert sb1[-1] == 'g' assert sb1[:-1] == 'jih' sb1.remove('i') assert sb1[:] == 'jhg' try: sb1.remove('a') except ValueError: pass else: raise Exception, "should throw ValueError" assert sb1[:] == 'jhg' sb1.sort() assert sb1[:] == 'ghj' |
From: <bc...@wo...> - 2001-01-29 13:56:51
|
[Brad Clements] >I have 3 python modules > >a.py, b.py and c.py > >b.py has > >from c import C > >I use jythonc with --package com.MurkWorks.FTPD > >The Java app can instantiate com.MurkWorks.FTPD.b okay. > >But when b tries to import class C from module c, it fails with > >importerror: cannot import name c > >-- > >So then I tried changing b.py to use > >from com.MurkWorks.FTPD.c import C > >This also fails with a similar import error. > >What's the proper method for multiple modules to load each other when >compiled with the --package option? There isn't any at the moment. The --package option is currectly most usefull when using the --deep option. That way the compiler knows that module "c" is in fact found as com.MurkWorks.FTPD.c. When you try to use from com.MurkWorks.FTPD.c import C you are hit by the problem that python modules can't be found as java classes in simple directories, only as modules in python packages (a directory with an __init__ module). regards, finn |
From: <bc...@wo...> - 2001-01-29 13:51:45
|
[Oliver Rutherfurd] >Is there any documentation regarding how jython handles static classes or >static methods of classes? Not really. Contributions are welcome. >I'm wondering things like whether a java static >class can be sub classed in jython, (and then end up with a static class) Yes, although I'm not entirely sure what you mean by a static class: package pack; public class Foo { public static class Bar { public void bar() { System.out.println("bar"); } } } import pack class SubBar(pack.Foo.Bar): def bar(self): print "SubBar" pack.Foo.Bar.bar(self) SubBar().bar() >whether you can declare a class method as static (for a non-static class) >which is written using jython. No. regards, finn |
From: <bc...@wo...> - 2001-01-29 13:50:45
|
[Mats Wichmann] >I was just trying out building a small app to display, using >a JFC/Swing gui, some data pulled out of an existing shelf - >here I'm not asking to serialize a Java class. Should this be >possible? Probably not, but it depends on the which database you used to make the shelf. By making sure that dumbdbm is used both when making the shelf and when reading it, it should be possible. The default way of creating and reading a shelf will not work though (as you have seen yourself). >(I've had no luck so far - the gripe is about a >missing anydbm module: would I be likely to be able to pull >this over?) Instead of using shelve.open(..) try instead: import shelve, dumbdbm shelve.Shelf(dumbdbm.open("file")) regards, finn |
From: Mats W. <ma...@la...> - 2001-01-28 12:43:57
|
>>Is there ability using jython and pickle save objects which classes is java >>classes ? >No (as you have dicovered yourself). I was just trying out building a small app to display, using a JFC/Swing gui, some data pulled out of an existing shelf - here I'm not asking to serialize a Java class. Should this be possible? (I've had no luck so far - the gripe is about a missing anydbm module: would I be likely to be able to pull this over?) Mats |
From: Oliver R. <fru...@ru...> - 2001-01-27 23:54:18
|
Hello, Is there any documentation regarding how jython handles static classes or static methods of classes? I'm wondering things like whether a java static class can be sub classed in jython, (and then end up with a static class) whether you can declare a class method as static (for a non-static class) which is written using jython. I've been playing around with writing a plugin for jEdit (http://jedit.sourceforge.net/) to allow either plugins or scripts for jEdit to be written in python (writing the plugin using jython). Some of the base classes for jEdit (such as the EditAction class) are static classes, and I'm not having much success with jEdit recognizing the subclasses written with jython - not sure where the problem lies, so I figured I should try to get a better understanding with some of the issues... I couldn't find anything in the jython docs regarding this, so I figured I try the list. Thanks in advance, -Ollie ol...@ru... |
From: D-Man <ds...@ri...> - 2001-01-26 23:32:51
|
On Fri, Jan 26, 2001 at 04:02:36PM -0600, David Blair wrote: | When I try to compile a Jython source file with jythonc.py it gives me | this error message: | ImportError: No module named org.python.parser | | I have I:\jython2.0 in the registry file in python.jythonc.classpath and | my CLASSPATH variable. Are you familiar with Java development? The problem is (probably) that you don't have jython.jar in the CLASSPATH. I'll assume that I:\jython2.0 is where you installed jython. You need to have "I:\jython2.0\jython.jar" in the classpath. (The jar file itself must be explicitly named, not the directory it is in. HTH, -D |
From: Robert W. B. <rb...@di...> - 2001-01-26 22:41:53
|
Hi David, On Fri, 26 Jan 2001, David Blair wrote: > When I try to compile a Jython source file with jythonc.py it gives me > this error message: > ImportError: No module named org.python.parser > > I have I:\jython2.0 in the registry file in python.jythonc.classpath and > my CLASSPATH variable. > > What could be happening? Are you using an installed version of Jython, or compiled class files that are not in a jar? I ask because because if it is an 'installation,' you actually need I:\jython2.0\jython.jar in the classpath (assuming you chose I:\jython2.0\ as the installation directory). The jar file contains the org.python.parser classes. There should also be a I:\jython2.0\jythonc.bat file that you can use to simplify the use of jythonc (i.e.- I:\jython2.0\jythonc myJythonFile.py). If you are using class files instead of the jar, then I might need more info... -Robert |
From: Brad C. <bk...@mu...> - 2001-01-26 22:41:51
|
I have 3 python modules a.py, b.py and c.py b.py has from c import C I use jythonc with --package com.MurkWorks.FTPD The Java app can instantiate com.MurkWorks.FTPD.b okay. But when b tries to import class C from module c, it fails with importerror: cannot import name c -- So then I tried changing b.py to use from com.MurkWorks.FTPD.c import C This also fails with a similar import error. What's the proper method for multiple modules to load each other when compiled with the --package option? I couldn't find an example of this in Demos. Brad Clements, bk...@mu... (315)268-1000 http://www.murkworks.com (315)268-9812 Fax netmeeting: ils://ils.murkworks.com AOL-IM: BKClements |
From: David B. <dbl...@ho...> - 2001-01-26 21:58:18
|
When I try to compile a Jython source file with jythonc.py it gives me this error message: ImportError: No module named org.python.parser I have I:\jython2.0 in the registry file in python.jythonc.classpath and my CLASSPATH variable. What could be happening? Thanks, Dave Blair |
From: Brad B. <bbu...@uc...> - 2001-01-26 03:57:46
|
Hi, On the topic of coercion, currently (correct me if I'm wrong) when a java numeric primitive (it, double, etc.) is accessed from jython code a conversion takes place from the native java type to a PyNumber object. Now, since Python offers many features (slicing, operator overloading, function pointers, etc.) that are extremely useful from a numerical computing standpoint (hence the success of NumPy) and Java offers excellent and robust Matrix libraries, 2D & 3D graphics, excellent gui, an advanced imaging package -- and so on -- Jython holds a lot of potential in the numerical computing arena (see ViSad, a scientific visualization package which has incorporated JPython as a scripting feature). That said, the current treatment of java primitives as PyObjects is a barrier to jython emerging as a (fast) platform for numerical computing. Is there any way that java primitives could be accessed "as-is" from within Jython? Note that Numerical Python suffers from requiring a rag-bag of supplementary tools for graphing, imaging, etc. -- which are not generally cross-platform -- while Java offers all these things in existing libraries either put out by Sun or downloadable off the web and, of course, fully cross-platform. So, to me, Jython has vastly more potential as a numerical computing language than Python proper. Moreover, proprietary computing environments like Matlab, Mathematica, and S-Plus are all scrambling to provide "java links" into their own languages. None of these links will ever be as good as the Jython-Java connection, nor will those scripting languages ever be as good as Python for general computing. (See www.omegahat.org for a project that is trying to integrate the S language and java at the cost of considerable complexity). Brad Buchsbaum ----- Original Message ----- From: "Finn Bock" <bc...@wo...> To: <jyt...@li...> Cc: <jyt...@li...>; <jpy...@py...> Sent: Thursday, January 25, 2001 12:06 PM Subject: [JPython] New Coercion Model > Hi, > > I have been working on a change to the coercion model that matches the > change that CPython 2.1 have introduced. The change only affect the > implementation of PyObject and its subclasses. It have no effect on > python objects that define __coerce__ or any of the other __XXX__ number > methods. > > The effect of the change is that the __XXX__ number methods can receive > argument(s) that aren't of the same type as itself. It is then the (new) > responsibility of each __XXX__ method to check its argument and return > Py.NotImplemented if the operation cannot be done with such an argument. > As a result the __coerce_ex__ is no longer called. > > The patch, as I have it now, does not supply a backward compatiblity > mode and that is subject on which I'm seeking feedback: > > I would like to hear from you if you have coded your own PyObject > subclass which override any of the number methods. Take a look at the > "new" way that this can be coded (example below is taken from PyFloat) > and send me your feedback and comments. > > Adding backward compatibility is ofcourse possible, but it would mean we > have to carry around some kind of flag around (NEW_STYLE_NUMBER) and I > would rather avoid that if possible. I would also like to get rid of the > currect coercion code because it complicated and there are bugs in it. > > The benefit of the new coercion model is improved speed when mixing > object types in operations because it isn't necessary to create a > temporary object and improved control from an extension type because it > now gets the unmodified arguments pass to it. > > The full patch can be found here: > > http://sourceforge.net/patch/index.php?func=detailpatch&patch_id=103419&grou p_id=12867 > > A few example methods taken from PyFloat. It showns how the numeric > methods can be implemented under the new coercion mode: > > > public PyObject __add__(PyObject right) { > if (!canCoerce(right)) > return Py.NotImplemented; > double rightv = coerce(right); > return new PyFloat(value + rightv); > } > > public PyObject __radd__(PyObject left) { > return __add__(left); > } > > public PyObject __sub__(PyObject right) { > if (!canCoerce(right)) > return Py.NotImplemented; > double rightv = coerce(right); > return new PyFloat(value - rightv); > } > > public PyObject __rsub__(PyObject left) { > if (!canCoerce(left)) > return Py.NotImplemented; > double leftv = coerce(left); > return new PyFloat(leftv - value); > } > > private static final boolean canCoerce(PyObject other) { > return other instanceof PyFloat || other instanceof PyInteger || > other instanceof PyLong; > } > > private static final double coerce(PyObject other) { > if (other instanceof PyFloat) > return ((PyFloat) other).value; > else if (other instanceof PyInteger) > return ((PyInteger) other).getValue(); > else if (other instanceof PyLong) > return ((PyLong) other).doubleValue(); > else > throw Py.TypeError("xxx"); > } > > > regards, > finn > > _______________________________________________ > JPython-Interest maillist - JPy...@py... > http://mail.python.org/mailman/listinfo/jpython-interest > |
From: Robert W. B. <rb...@di...> - 2001-01-25 20:57:41
|
Just for fun... Not as brief as David's, nor as fun as Brian's, but lest we forget the ease with wich we can abuse Java classes: ------------------------------------------------------ from java import io class ff(io.FilenameFilter): def accept(self, dir, name): if name.lower()[-4:] == ".jar": return 1 L = io.File("/home/rbill").list( ff() ) print L ------------------------------------------------------ -Robert On Thu, 25 Jan 2001, David Syer wrote: > > > > -----Original Message----- > > From: Naga Nunna [mailto:na...@lu...] > > Sent: 25 January 2001 17:12 > > To: jpy...@py... > > > How do we do the equivalent of 'ls <path>/*.jar' in > > JPython? > > $ from glob import glob > $ glob('path/*.jar') > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users > |
From: <bc...@wo...> - 2001-01-25 20:07:07
|
Hi, I have been working on a change to the coercion model that matches the change that CPython 2.1 have introduced. The change only affect the implementation of PyObject and its subclasses. It have no effect on python objects that define __coerce__ or any of the other __XXX__ number methods. The effect of the change is that the __XXX__ number methods can receive argument(s) that aren't of the same type as itself. It is then the (new) responsibility of each __XXX__ method to check its argument and return Py.NotImplemented if the operation cannot be done with such an argument. As a result the __coerce_ex__ is no longer called. The patch, as I have it now, does not supply a backward compatiblity mode and that is subject on which I'm seeking feedback: I would like to hear from you if you have coded your own PyObject subclass which override any of the number methods. Take a look at the "new" way that this can be coded (example below is taken from PyFloat) and send me your feedback and comments. Adding backward compatibility is ofcourse possible, but it would mean we have to carry around some kind of flag around (NEW_STYLE_NUMBER) and I would rather avoid that if possible. I would also like to get rid of the currect coercion code because it complicated and there are bugs in it. The benefit of the new coercion model is improved speed when mixing object types in operations because it isn't necessary to create a temporary object and improved control from an extension type because it now gets the unmodified arguments pass to it. The full patch can be found here: http://sourceforge.net/patch/index.php?func=detailpatch&patch_id=103419&group_id=12867 A few example methods taken from PyFloat. It showns how the numeric methods can be implemented under the new coercion mode: public PyObject __add__(PyObject right) { if (!canCoerce(right)) return Py.NotImplemented; double rightv = coerce(right); return new PyFloat(value + rightv); } public PyObject __radd__(PyObject left) { return __add__(left); } public PyObject __sub__(PyObject right) { if (!canCoerce(right)) return Py.NotImplemented; double rightv = coerce(right); return new PyFloat(value - rightv); } public PyObject __rsub__(PyObject left) { if (!canCoerce(left)) return Py.NotImplemented; double leftv = coerce(left); return new PyFloat(leftv - value); } private static final boolean canCoerce(PyObject other) { return other instanceof PyFloat || other instanceof PyInteger || other instanceof PyLong; } private static final double coerce(PyObject other) { if (other instanceof PyFloat) return ((PyFloat) other).value; else if (other instanceof PyInteger) return ((PyInteger) other).getValue(); else if (other instanceof PyLong) return ((PyLong) other).doubleValue(); else throw Py.TypeError("xxx"); } regards, finn |
From: David S. <ds...@al...> - 2001-01-25 19:33:24
|
> -----Original Message----- > From: Naga Nunna [mailto:na...@lu...] > Sent: 25 January 2001 17:12 > To: jpy...@py... > How do we do the equivalent of 'ls <path>/*.jar' in > JPython? $ from glob import glob $ glob('path/*.jar') |