Python Scripting

2005-01-22 Thread Ali Polatel
  Hi Dear Python programmers,   I want to ask you a question about python scripting.I want to know if I can design web-pages with python or at least write html files with python. and if I write html files with python and some CGI scripts and upload them to the web-page .. does the people who view t

debugging xmlrpc servers

2005-01-22 Thread alan dot ezust at gmail dot com
Problems with XMLRPC I have an xmlrpc server with a method called results() which returns an XML message. I've been able to use this function without problems when I had only one client talking to one server. I have recently introduced a P2P aspect to this process and now I have servers calling e

Re: rotor replacement

2005-01-22 Thread Paul Rubin
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > > You're not making any bloody sense. > > oh, I make perfect sense, and I think most people here understand > why I found your little "lecture" so funny. if you still don't get > it, maybe some- one can explain it to you. I would appreciate it if som

Re: [OT] XML design intent [was Re: What YAML engine do you use?]

2005-01-22 Thread Peter Hansen
Stephen Waterbury wrote: it's interesting to note that the intent Steve Holden imputed to it earlier is not explicitly among them: Steve Holden wrote: It seems to me the misunderstanding here is that XML was ever intended to be generated directly by typing in a text editor. It was rather intended

What's so funny? WAS Re: rotor replacement

2005-01-22 Thread Brian van den Broek
Paul Rubin said unto the world upon 2005-01-22 20:16: "Fredrik Lundh" <[EMAIL PROTECTED]> writes: You're not making any bloody sense. oh, I make perfect sense, and I think most people here understand why I found your little "lecture" so funny. if you still don't get it, maybe some- one can explain

Re: embedding jython in CPython...

2005-01-22 Thread johng2001
> As for using JPype ... well it depends on what you want to script. if > you Java code is the main app, I'd eschew CPython completely and use > Jython to script. If you main app is in Python, and the Java code is > "simply" libraries you wish to use, then I'f go with CPython + Jpype. It > is very

Re: What's so funny? WAS Re: rotor replacement

2005-01-22 Thread Paul Rubin
Brian van den Broek <[EMAIL PROTECTED]> writes: > no Python expert, just a hobbyist. But, I think I can take this one on: > > Fredrik's contributed a lot to Python. The Standard Library book, > several well know tools, and, I'd wager a finger, a fair bit of code > in the standard lib. I don't thin

Re: [OT] XML design intent ... further musings

2005-01-22 Thread Stephen Waterbury
Peter Hansen wrote: If merely thinking about the purpose of XML doesn't make it clear where Steve got that idea ... I meant no disparagement of Steve, and it is quite clear where he got that (correct!) idea ... It's also clear that the XML user community sees that as part of *their* purpose in appl

Re: problems with duplicating and slicing an array

2005-01-22 Thread David Isaac
Yun Mao wrote: >a[ [1,0], [0,1] ] , which should give me >[[4, 5], [1,2]] Numeric: take(take(a,[1,0]),[0,1],1) fwiw, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: embedding jython in CPython...

2005-01-22 Thread Jim Hargrave
Sorry - should have given more detail. That's what I get for posting at 1:00AM. What I want to do us write scripts in CPython that access Windows ActiveX such as Word and IE. Obviously Jython can't do this (easily at least). I also have Jython scripts that provide a high level layer on top of

Re: What YAML engine do you use?

2005-01-22 Thread Leif K-Brooks
Bengt Richter wrote: I thought XML was a good idea, but IMO requiring quotes around even integer attribute values was an unfortunate decision. I think it helps guard against incompetent authors who wouldn't understand when they're required to use quotes and when they're not. I see HTML pages all

Re: [OT] XML design intent ... further musings

2005-01-22 Thread Paul Rubin
Stephen Waterbury <[EMAIL PROTECTED]> writes: > I should note that I have to deal with XML a lot, but always > kicking and screaming (though much less now because of Fredrik's > Elementtree package ;). Thanks, Fredrik and Peter, for the > references. ;) I love this old rant about XML: http://gr

Re: What YAML engine do you use?

2005-01-22 Thread Steve Holden
Doug Holton wrote: Fredrik Lundh wrote: and trust me, when things are hard to get right for developers, users will suffer too. That is exactly why YAML can be improved. But XML proves that getting it "right" for developers has little to do with getting it right for users (or for saving bandwid

Re: specifying constants for a function (WAS: generator expressions: performance anomaly?)

2005-01-22 Thread Bengt Richter
On Sat, 22 Jan 2005 16:22:33 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: >Steven Bethard wrote: >> I wrote: >> > If you really want locals that don't contribute to arguments, I'd be >> > much happier with something like a decorator, e.g.[1]: >> > >> > @with_consts(i=1, deftime=time.ctime())

Re: Zen of Python

2005-01-22 Thread Tim Peters
[Tim Peters] >> But at that time, Python didn't have lexical scoping, and it wasn't >> clear that it ever would. So what's the bigger wart? Making >> listcomps exactly equivalent to an easily-explained Python for-loop >> nest, or introducing a notion of lexical scope unique to listcomps, >> hard

Re: getting file size

2005-01-22 Thread Tim Roberts
Bob Smith <[EMAIL PROTECTED]> wrote: >Are these the same: > >1. f_size = os.path.getsize(file_name) > >2. fp1 = file(file_name, 'r') >data = fp1.readlines() >last_byte = fp1.tell() > >I always get the same value when doing 1. or 2. Is there a reason I >should do both? When reading to the

Re: dynamic call of a function

2005-01-22 Thread Nick Coghlan
kishore wrote: Hi Luigi Ballabio, Thankyou very much for your reply, it worked well. It does work in most cases, but "getattr(self, methodName)" is generally to be preferred over "vars(self.__class__)[methodName]", as the latter does not use Python's standard attribute lookup scheme. The semanti

Re: list unpack trick?

2005-01-22 Thread Nick Coghlan
aurora wrote: I am think more in the line of string.ljust(). So if we have a list.ljust(length, filler), we can do something like name, value = s.split('=',1).ljust(2,'') Eh? Py> s.split('=',1).ljust(2,'') Traceback (most recent call last): File "", line 1, in ? AttributeError: 'list' object

Re: default value in a list

2005-01-22 Thread Nick Coghlan
Reinhold Birkenfeld wrote: Why not put these together and put it in itertools, since the requirement seems to crop up every other week? >>> line = "A:B:C".split(":") ... >>> def ipad(N,iterable, default = None): ... return it.islice(it.chain(iterable, it.repeat(default)), N) ... >>> a,b

JPype and classpath (Was Re: embedding jython in CPython... )

2005-01-22 Thread Steve Menard
While we are on topic, I am having some trouble understanding JPype classpath. How do I init the JVM with the folder in which the Python program is located included in the classpath? I tried t = JPackage('.').test That did not work. My environment variable includes current folder in the classpath I

Re: embedding jython in CPython...

2005-01-22 Thread Steve Menard
Jim Hargrave wrote: Sorry - should have given more detail. That's what I get for posting at 1:00AM. What I want to do us write scripts in CPython that access Windows ActiveX such as Word and IE. Obviously Jython can't do this (easily at least). I also have Jython scripts that provide a high le

Re: embedding jython in CPython...

2005-01-22 Thread Jim Hargrave
> I am curious to know what makes your Jython code incompatible with > CPython. If it is only because it uses Java classes, it might > not be too > difficult to port them to CPython+Jpype. CPython+Jpype may indeed be the way to go in the long run - it's only my ignorance stoping me at this point :

RE: Python Scripting

2005-01-22 Thread Robert Brewer
Ali Polatel wrote: > I want to ask you a question about python scripting. > I want to know if I can design web-pages with python Yes. > or at least write html files with python. Yes. > and if I write html files with python and some CGI scripts > and upload them to the web-page .. does the peopl

Re: Unbinding multiple variables

2005-01-22 Thread Nick Coghlan
Bengt Richter wrote: (OTOH, deletions of actual local bindings do seem to propagate back into a previously bound value of locals on exit, and a new call to locals() seems to return the same identical object as before, so I'm not sure I believe the , unless it has a special slot and it is automat

Re: list unpack trick?

2005-01-22 Thread Fredrik Lundh
Nick Coghlan wrote: >> I am think more in the line of string.ljust(). So if we have a >> list.ljust(length, filler), we >> can do something like >> >> name, value = s.split('=',1).ljust(2,'') > > Eh? > > Py> s.split('=',1).ljust(2,'') > Traceback (most recent call last): > File "", line 1,

Re: finding name of instances created

2005-01-22 Thread Nick Coghlan
André wrote: I have tried this exact example (using Python 2.3 if it makes any difference) and what I got was: robot None moved robot None moved I checked what I wrote, used cut & paste on your code, removing the leading "junk", tried it again ... to no avail. :-( Worked exactly as written for me,

Re: finding name of instances created

2005-01-22 Thread Nick Coghlan
André wrote: So, students will be able to write: pete = CreateRobot(2, 3) pete.move() learning about objects and methods. As for things like for robot in robots: do stuff that will be for my use only: drawing robots on the screen, updating the 'world' when robots pick stuff up, etc. My intention i

Re: default value in a list

2005-01-22 Thread Reinhold Birkenfeld
Nick Coghlan wrote: > Reinhold Birkenfeld wrote: >>>Why not put these together and put it in itertools, since the requirement >>>seems >>>to crop up every other week? >>> >>> >>> line = "A:B:C".split(":") >>> ... >>> >>> def ipad(N,iterable, default = None): >>> ... return it.islice(it.ch

Re: [OT] XML design intent [was Re: What YAML engine do you use?]

2005-01-22 Thread Doug Holton
Peter Hansen wrote: Good question. The point is that an XML document is sometimes a file, sometimes a record in a relational database, sometimes an object delivered by an Object Request Broker, and sometimes a stream of bytes arriving at a network socket. These can all be described a

Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
Steve Holden wrote: Yet again I will interject that XML was only ever intended to be wriiten by programs. Hence its moronic stupidity and excellent uniformity. Neither was HTML, neither were URLs, neither were many things used the way they were intended. YAML, however, is specifically designed t

Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
Daniel Bickett wrote: In my (brief) experience with YAML, it seemed like there were several different ways of doing things, and I saw this as one of it's failures (since we're all comparing it to XML). However I maintain, in spite of all of that, that it can easily boil down to the fact that, for s

Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
You might like programming in XML then: http://www.meta-language.net/ Actually, the samples are hard to find, they are here: http://www.meta-language.net/sample.html Programming in XML makes Perl and PHP look like the cleanest languages ever invented. -- http://mail.python.org/mailman/listinfo/pyt

<    1   2