looking for help with Jython...
Jeffrey, try this: 1. change first line to public class Vehicle { 2. shell> javac Vehicle.java 3. shell> jython [liao@zen tmp]$ jython Jython 2.1 on java1.3.1 (JIT: null) Type "copyright", "credits" or "license" for more information.
import Vehicle v = Vehicle(3,5,6) v Vehicle@3f1179
cheers, Luby
I'm in the middle of learning some Java to get ready for next year's AP CSC course. I would like to make good use of the Python my students already know, and I was thinking that Jython might offer some interesting educational opportunities.
What I would most like to be able to do is to import Java classes into Python in order to be able to "play around" with them in the interpreter. So far, I have not been able to make this work. I'm starting with a simple example from our book:
class Vehicle { public int passengers; public int fuelcap; public int mpg;
public Vehicle(int p, int f, int m) { passengers = p; fuelcap = f; mpg = m; }
public int range() { return mpg * fuelcap; }
public double fuelneeded(int miles) { return (double) miles / mpg; } }
(Actually, I added all the "public"s because otherwise Jython
couldn't
see them when I did:
import Vehicle
How can I create a Vehicle object inside of Jython?
Thanks!
Thanks, Luby, this worked like a charm! It is also *way too cool* ;-) This is what I had hoped to be able to do, and it worked just liked I had hoped it would. We have a real opportunity here to promote Python next year. I will be working closely with my colleagues from the other schools in our system next year to develop the new Java course. It will be a great chance to promote the use of Python in our first year courses. Jython and the ability to interact with Java classes like this adds tremendously to the already strong case for using Python. Thanks again! jeff On Wed, 2003-04-30 at 00:52, luby liao wrote:
Jeffrey, try this:
1. change first line to
public class Vehicle {
2. shell> javac Vehicle.java
3. shell> jython
[liao@zen tmp]$ jython Jython 2.1 on java1.3.1 (JIT: null) Type "copyright", "credits" or "license" for more information.
import Vehicle v = Vehicle(3,5,6) v Vehicle@3f1179
cheers, Luby
I'm in the middle of learning some Java to get ready for next year's AP CSC course. I would like to make good use of the Python my students already know, and I was thinking that Jython might offer some interesting educational opportunities.
What I would most like to be able to do is to import Java classes into Python in order to be able to "play around" with them in the interpreter. So far, I have not been able to make this work. I'm starting with a simple example from our book:
class Vehicle { public int passengers; public int fuelcap; public int mpg;
public Vehicle(int p, int f, int m) { passengers = p; fuelcap = f; mpg = m; }
public int range() { return mpg * fuelcap; }
public double fuelneeded(int miles) { return (double) miles / mpg; } }
(Actually, I added all the "public"s because otherwise Jython
couldn't
see them when I did:
import Vehicle
How can I create a Vehicle object inside of Jython?
Thanks!
_______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig -- Jeffrey Elkner <jeff@elkner.net>
So I went to Victoria, Canada this weekend to hang with some of the Ploners, including Alan Runyaga, the principal Python coder behind this intricate extrapolation of Zope and CMF (Limi is more responsible for the pleasing look, thanks to his intimate knowledge of CSS (style sheets for XHTML)). I don't know what Vidar's role has been exactly (the third name that appears at the bottom of the Plone Welcome page). Andy McKay was there -- a major player in Zope world, creator of the ZopeZen site, which is undergoing a major overhaul right now, having been slain by a virus. One thing that impressed me about Alan is that he's not a fanatic or at all defensive about Plone, even though he works on it all the time. He has distance and perspective, coming from a strong background in computer science with plenty of C++ and Java and stuff like that. At one point over food he said "I hate programming for the web" (funny, coming from a guy who does this full time) -- meaning it's always bound to be broken in some way, like some web browser is going to render a page differently or mess up in some way. There was a lot of talk about Zope 3, as well as 2.7. We had a big TV at our hosts' home (Jim Roepcke and his wife Cheryl) and saw some interesting demos, e.g. of staging in Plone (three synched versions, letting developers move stuff to production in steps), and ZEO, a Zope Corp utility allowing many real time clients to communicate with the same ZODB on the back end. This was billed as a 'Plone Sprint' meaning we were supposed to get some work done, and given the level of sophistication among the attenders (I was a relative newbie for sure), work really did get done. Improvements to news syndication within Plone, a group folder, debugging against CMF 1.4 beta, and improvements to the documentation, were all accomplished, with some time left over for socializing and multi-user Halo on Jim's Xbox (connected to that large TV). Jonaugustine traveled the farthest to be there -- all the way from Hawaii. The state of Hawaii's intranet is moving to Plone these days. I'm heading down to Powell's Technical today, realizing I need to own a copy of The Zope Bible, which gets more technical than some of the others, and shows how to interact directly with the ZODB (Zope object database) from within the Python shell. That's the kind of low level stuff I need a better handle on. Kirby
"Kirby Urner" <urnerk@qwest.net> writes:
I'm heading down to Powell's Technical today, realizing I need to own a copy of The Zope Bible, which gets more technical than some of the others, and shows how to interact directly with the ZODB (Zope object database) from within the Python shell. That's the kind of low level stuff I need a better handle on.
I haven't done it in a while, but you should be able to navigate a ZODB using PyCrust, which gives you autocompletion and the namespace tree view, both of which make it much easier to figure out what exactly is in a ZODB database. -- Patrick K. O'Brien Orbtech http://www.orbtech.com/web/pobrien ----------------------------------------------- "Your source for Python programming expertise." -----------------------------------------------
Kirby, Thanks for the report on the Plone sprint, that sounds like fun. I wish I'd known you were going to be in BC, I'd have tried to meet up with you. I work in Vancouver (will be living there too, after next week). Maybe next time. Anyone coming to Vancouver for SVG Open in July? http://www.svgopen.org/ --Dethe
At 03:22 PM 5/8/2003 -0700, Dethe Elza wrote:
Kirby,
Thanks for the report on the Plone sprint, that sounds like fun. I wish I'd known you were going to be in BC, I'd have tried to meet up with you. I work in Vancouver (will be living there too, after next week). Maybe next time.
Dang! Wish I'd known you were there too. The sprint was advertised at www.plone.org and anyone could sign up through the wiki -- but there're just too many websites to track. I didn't make it to Vancouver proper, but I know it's a beautiful city. You're lucky to be living there.
Anyone coming to Vancouver for SVG Open in July?
Hey, looks like fun. Right after OSCON in Portland. But the only way I can really afford these conferences is to speak at 'em (and hence gain admittance). I'm afraid my SVG is not up to snuff yet.
--Dethe
At 01:30 PM 5/8/2003 -0500, Patrick K. O'Brien wrote:
I haven't done it in a while, but you should be able to navigate a ZODB using PyCrust, which gives you autocompletion and the namespace tree view, both of which make it much easier to figure out what exactly is in a ZODB database.
As I recall, this feature of PyCrust was actually mentioned appreciatively, by either Alan or Andy as I recall. Kevin Altis came by my house a few weeks ago and helped me get PythonCard up and running, inside of which PyCrust is a feature. I now boot into PythonCard sometimes, and will do so some more when I get deeper into the Zope Bible stuff (just got my copy today -- I know a lot of what's in it already, but felt a clear need for this tome in particular). Kirby
On Thursday, May 8, 2003, at 06:22 PM, Dethe Elza wrote:
Kirby,
Thanks for the report on the Plone sprint, that sounds like fun. I wish I'd known you were going to be in BC, I'd have tried to meet up with you. I work in Vancouver (will be living there too, after next week). Maybe next time.
If anyone is going to OSCOM or otherwise in the Cambridge, MA area, I just posted a "Plone in Schools" birds of a feather meeting at the conference on Thursday, May 29 at 5:15 at John Harvard's Brew House. http://conferences.oscom.org/cambridge/may_2003/boffer/ view_entry.php?id=36&area=8&day=29&month=5&year=2003 Tom Hoffman http://tuttlesvc.org
Hi All, I've been talking to Steve Holden about my interest in organizing a "Python in Education" track at next years PyCon. The message below just appeared on the pycon-organizers list, so I thought I would pass it along here and ask you all if you are thinking about attending PyCon next year and if you would be interested in a Python in Education track. Thanks! jeff PyCon DC 2004 Kickoff!
Following on the heels of the successful PyCon DC 2003, we're getting an early start for PyCon DC 2004. Details are not final, but we're planning to hold the conference in late March, with a two-day sprint before the conference.
The deadline for presentation proposals is December 1. Proposals should be an abstract or outline of five hundred (500) to two thousand (2000) words. Proposals will be accepted by December 31. The deadline for submitting the final presentation in electronic form is February 15.
Early-bird registration will be $150 (through February 1), standard registration will be $200 (through March 15), and on-site registration will be $250. We hope to have the registration system on-line soon. -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/
participants (6)
-
Dethe Elza
-
Jeffrey Elkner
-
Kirby Urner
-
luby liao
-
pobrien@orbtech.com
-
tom_hoffman@mac.com