embedding jython in CPython...

2005-01-22 Thread Jim Hargrave
I've read that it is possible to compile jython to native code using GCJ. PyLucene uses this approach, they then use SWIG to create a Python wrapper around the natively compiled (java) Lucene. Has this been done before for with jython? Another approach would be to use JPype to call the jython

Re: default value in a list

2005-01-22 Thread Alex Martelli
TB [EMAIL PROTECTED] wrote: Is there an elegant way to assign to a list from a list of unknown size? For example, how could you do something like: a, b, c = (line.split(':')) if line could have less than three fields? import itertools as it a, b, c = it.islice( it.chain(

Re: Zen of Python

2005-01-22 Thread Alex Martelli
Dave Benjamin [EMAIL PROTECTED] wrote: Can we get a show of hands for all of those who have written or are currently maintaining code that uses the leaky listcomp feature? Have written: guilty -- basically to show how NOT to do things. Currently maintaining: you _gotta_ be kidding!-) I

Re: list unpack trick?

2005-01-22 Thread Alex Martelli
Fredrik Lundh [EMAIL PROTECTED] wrote: ... or (readable): if len(list) n: list.extend((n - len(list)) * [item]) I find it just as readable without the redundant if guard -- just: alist.extend((n - len(alist)) * [item]) of course, this guard-less version depends on N*[x]

Re: Reload Tricks

2005-01-22 Thread Alex Martelli
Kamilche [EMAIL PROTECTED] wrote: I want my program to be able to reload its code dynamically. I have a large hierarchy of objects in memory. The inheritance hierarchy of these objects are scattered over several files. Michael Hudson has a nice custom metaclass for that in Activestate's

Re: default value in a list

2005-01-22 Thread Peter Otten
Paul McGuire wrote: Is there an elegant way to assign to a list from a list of unknown size? For example, how could you do something like: a, b, c = (line.split(':')) if line could have less than three fields? I asked a very similar question a few weeks ago, and from the various

Re: need help on need help on generator...

2005-01-22 Thread Alex Martelli
Francis Girard [EMAIL PROTECTED] wrote: ... But besides the fact that generators are either produced with the new yield reserved word or by defining the __new__ method in a class definition, I don't know much about them. Having __new__ in a class definition has nothing much to do with

introducing a newbie to newsgroups

2005-01-22 Thread Reed L. O'Brien
Super Sorry for the extra traffic. ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: need help on need help on generator...

2005-01-22 Thread Alex Martelli
Nick Coghlan [EMAIL PROTECTED] wrote: 5. Several builtin functions return iterators rather than lists, specifically xrange(), enumerate() and reversed(). Other builtins that yield sequences (range(), sorted(), zip()) return lists. Yes for enumerate and reversed, no for xrange: xx=xrange(7)

Re: default value in a list

2005-01-22 Thread Peter Otten
Peter Otten wrote: Paul McGuire wrote: Is there an elegant way to assign to a list from a list of unknown size? For example, how could you do something like: a, b, c = (line.split(':')) if line could have less than three fields? I asked a very similar question a few weeks ago, and

Re: rotor replacement

2005-01-22 Thread Nick Craig-Wood
Paul Rubin http wrote: Here's the message I had in mind: http://groups-beta.google.com/group/comp.lang.python/msg/adfbec9f4d7300cc It came from someone who follows Python crypto issues as closely as anyone, and refers to a consensus on python-dev. I'm not on python-dev myself but I

Re: need help on need help on generator...

2005-01-22 Thread Craig Ringer
On Sat, 2005-01-22 at 10:10 +0100, Alex Martelli wrote: The answer for the current implementation, BTW, is in between -- some buffering, but bounded consumption of memory -- but whether that tidbit of pragmatics is part of the file specs, heh, that's anything but clear (just as for other

Re: need help on need help on generator...

2005-01-22 Thread Francis Girard
Le samedi 22 Janvier 2005 10:10, Alex Martelli a crit: Francis Girard [EMAIL PROTECTED] wrote: ... But besides the fact that generators are either produced with the new yield reserved word or by defining the __new__ method in a class definition, I don't know much about them. Having

Re: need help on need help on generator...

2005-01-22 Thread Craig Ringer
On Sat, 2005-01-22 at 17:46 +0800, I wrote: I'd be interested to know if there's a better solution to this than: . inpath = '/tmp/msg.eml' . infile = open(inpath) . initer = iter(infile) . headers = [] . for line in initer: if not line.strip(): break

Re: list unpack trick?

2005-01-22 Thread Fredrik Lundh
Alex Martelli wrote: or (readable): if len(list) n: list.extend((n - len(list)) * [item]) I find it just as readable without the redundant if guard -- just: alist.extend((n - len(alist)) * [item]) the guard makes it obvious what's going on, also for a reader that doesn't

Re: finding name of instances created

2005-01-22 Thread Alex Martelli
André Roberge [EMAIL PROTECTED] wrote: alex = CreateRobot() anna = CreateRobot() alex.move() anna.move() H -- while I've long since been identified as a 'bot, I can assure you that my wife Anna isn't! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: default value in a list

2005-01-22 Thread Nick Craig-Wood
TB [EMAIL PROTECTED] wrote: Is there an elegant way to assign to a list from a list of unknown size? For example, how could you do something like: a, b, c = (line.split(':')) if line could have less than three fields? You could use this old trick... a, b, c =

Re: Class introspection and dynamically determining function arguments

2005-01-22 Thread Bengt Richter
On Fri, 21 Jan 2005 20:23:58 -0500, Mike C. Fletcher [EMAIL PROTECTED] wrote: On Thu, 20 Jan 2005 11:24:12 -, Mark English [EMAIL PROTECTED] wrote: I'd like to write a Tkinter app which, given a class, pops up a window(s) with fields for each attribute of that class. The user could

re Insanity

2005-01-22 Thread Tim Daneliuk
For some reason, I am having the hardest time doing something that should be obvious. (Note time of posting ;) Given an arbitrary string, I want to find each individual instance of text in the form: [PROMPT:optional text] I tried this: y=re.compile(r'\[PROMPT:.*\]') Which works fine when the

Re: need help on need help on generator...

2005-01-22 Thread Alex Martelli
Francis Girard [EMAIL PROTECTED] wrote: ... A 'def' of a function whose body uses 'yield', and in 2.4 the new genexp construct. Ok. I guess I'll have to update to version 2.4 (from 2.3) to follow the discussion. It's worth upgrading even just for the extra speed;-). Since you

Re: Comments in configuration files

2005-01-22 Thread Tim Daneliuk
Pierre Quentel wrote: Bonjour, I am developing an application and I have a configuration file with a lot of comments to help the application users understand what the options mean I would like it to be editable, through a web browser or a GUI application. With ConfigParser I can read the

Re: list unpack trick?

2005-01-22 Thread Alex Martelli
Fredrik Lundh [EMAIL PROTECTED] wrote: Alex Martelli wrote: or (readable): if len(list) n: list.extend((n - len(list)) * [item]) I find it just as readable without the redundant if guard -- just: alist.extend((n - len(alist)) * [item]) the guard makes it

Re: Insanity

2005-01-22 Thread Fredrik Lundh
Tim Daneliuk wrote: Given an arbitrary string, I want to find each individual instance of text in the form: [PROMPT:optional text] I tried this: y=re.compile(r'\[PROMPT:.*\]') Which works fine when the text is exactly [PROMPT:whatever] didn't you leave something out here? compile

Re: re Insanity

2005-01-22 Thread Duncan Booth
Tim Daneliuk wrote: I tried this: y=re.compile(r'\[PROMPT:.*\]') Which works fine when the text is exactly [PROMPT:whatever] but does not match on: something [PROMPT:foo] something [PROMPT:bar] something ... The overall goal is to identify the beginning and end of each

Re: need help on need help on generator...

2005-01-22 Thread Alex Martelli
Craig Ringer [EMAIL PROTECTED] wrote: . data = ''.join(x for x in infile) Maybe ''.join(infile) is a better way to express this functionality? Avoids 2.4 dependency and should be faster as well as more concise. Might it be worth providing a way to have file objects seek back to the current

Re: Class introspection and dynamically determining function arguments

2005-01-22 Thread Alex Martelli
Diez B. Roggisch [EMAIL PROTECTED] wrote: Nick Coghlan wrote: If this only has to work for classes created for the purpose (rather than for an arbitrary class): Certainly a step into the direction I meant - but still missing type declarations. And that's what at least I'd like to see

Re: default value in a list

2005-01-22 Thread Alex Martelli
Nick Craig-Wood [EMAIL PROTECTED] wrote: ... Or this version if you want something other than as the default a, b, b = (line.split(':') + 3*[None])[:3] Either you mean a, b, c -- or you're being subtler than I'm grasping. BTW This is a feature I miss from perl... Hmmm, I understand

Re: dynamic call of a function

2005-01-22 Thread kishore
Hi Luigi Ballabio, Thankyou very much for your reply, it worked well. Kishore. Luigi Ballabio wrote: At 10:37 AM 10/19/01 +0200, anthony harel wrote: Is it possible to make dynamic call of a function whith python ? I have got a string that contains the name of the function I want to call

Re: need help on need help on generator...

2005-01-22 Thread Craig Ringer
On Sat, 2005-01-22 at 12:20 +0100, Alex Martelli wrote: Craig Ringer [EMAIL PROTECTED] wrote: . data = ''.join(x for x in infile) Maybe ''.join(infile) is a better way to express this functionality? Avoids 2.4 dependency and should be faster as well as more concise. Thanks - for some

[perl-python] 20050121 file reading writing

2005-01-22 Thread Xah Lee
# -*- coding: utf-8 -*- # Python # to open a file and write to file # do f=open('xfile.txt','w') # this creates a file object and name it f. # the second argument of open can be # 'w' for write (overwrite exsiting file) # 'a' for append (ditto) # 'r' or read only # to actually print to file

Re: circular iteration

2005-01-22 Thread Alex Martelli
Simon Brunning [EMAIL PROTECTED] wrote: ... is there a faster way to build a circular iterator in python that by doing this: c=['r','g','b','c','m','y','k'] for i in range(30): print c[i%len(c)] I don''t know if it's faster, but: import itertools

Re: Unbinding multiple variables

2005-01-22 Thread Bengt Richter
On 21 Jan 2005 11:13:20 -0800, Johnny Lin [EMAIL PROTECTED] wrote: thanks everyone for the replies! John Hunter, yep, this is Johnny Lin in geosci :). re using return: the problem i have is somewhere in my code there's a memory leak. i realize return is supposed to unbind all the local

Re: Zen of Python

2005-01-22 Thread Paul Rubin
Dave Benjamin [EMAIL PROTECTED] writes: Can we get a show of hands for all of those who have written or are currently maintaining code that uses the leaky listcomp feature? It's really irrelevant whether anyone is using a feature or not. If the feature is documented as being available, it

Re: finding name of instances created

2005-01-22 Thread André
Jeremy Bowers wrote: On Fri, 21 Jan 2005 21:01:00 -0400, André Roberge wrote: etc. Since I want the user to learn Python's syntax, I don't want to require him/her to write alex = CreateRobot(name = 'alex') to then be able to do alex.move() This is just my opinion, but I've been

Re: Zen of Python

2005-01-22 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: If it changed the semantics of for-loops in general, that would be quite inconvenient to me -- once in a while I do rely on Python's semantics (maintaining the loop control variable after a break; I don't recall if I ever used the fact that the

Re: Zen of Python

2005-01-22 Thread Fredrik Lundh
Paul Rubin wrote: Some languages let you say things like: for (var x = 0; x 10; x++) do_something(x); and that limits the scope of x to the for loop. depending on the compiler version, compiler switches, IDE settings, etc. /F --

Re: rotor replacement

2005-01-22 Thread Paul Rubin
Nick Craig-Wood [EMAIL PROTECTED] writes: No, unfortunately; the python-dev consensus was that encryption raised export control issues, and the existing rotor module is now on its way to being removed. I'm sure thats wrong now-a-days. Here are some examples of open source software with

Re: Zen of Python

2005-01-22 Thread Paul Rubin
Fredrik Lundh [EMAIL PROTECTED] writes: Some languages let you say things like: for (var x = 0; x 10; x++) do_something(x); and that limits the scope of x to the for loop. depending on the compiler version, compiler switches, IDE settings, etc. Huh? I'm not sure what you're

Re: [perl-python] 20050121 file reading writing

2005-01-22 Thread Gian Mario Tagliaretti
Xah Lee wrote: # the second argument of open can be # 'w' for write (overwrite exsiting file) # 'a' for append (ditto) # 'r' or read only are you sure you didn't forget something? # reading the one line # line = f.realine() wrong [...] Maybe you didn't get the fact the you won't see a

Re: Zen of Python

2005-01-22 Thread Alex Martelli
Paul Rubin http://[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Alex Martelli) writes: If it changed the semantics of for-loops in general, that would be quite inconvenient to me -- once in a while I do rely on Python's semantics (maintaining the loop control variable after a break; I don't

Re: Zen of Python

2005-01-22 Thread Alex Martelli
Paul Rubin http://[EMAIL PROTECTED] wrote: Dave Benjamin [EMAIL PROTECTED] writes: Can we get a show of hands for all of those who have written or are currently maintaining code that uses the leaky listcomp feature? It's really irrelevant whether anyone is using a feature or not. If the

Re: Zen of Python

2005-01-22 Thread Fredrik Lundh
Paul Rubin wrote: Some languages let you say things like: for (var x = 0; x 10; x++) do_something(x); and that limits the scope of x to the for loop. depending on the compiler version, compiler switches, IDE settings, etc. Huh? I'm not sure what you're talking about. guess

Re: default value in a list

2005-01-22 Thread Bengt Richter
On Fri, 21 Jan 2005 17:04:11 -0800, Jeff Shannon [EMAIL PROTECTED] wrote: TB wrote: Hi, Is there an elegant way to assign to a list from a list of unknown size? For example, how could you do something like: a, b, c = (line.split(':')) if line could have less than three fields?

Re: What YAML engine do you use?

2005-01-22 Thread Fredrik Lundh
Reinhold Birkenfeld wrote: Agreed. If you just want to use it, you don't need the spec anyway. but the guy who wrote the parser you're using had to read it, and understand it. judging from the number of crash reports you see in this thread, chances are that he didn't. /F --

Re: rotor replacement

2005-01-22 Thread Fredrik Lundh
Paul Rubin wrote: Martin, do you know more about this? I remember being disappointed about the decisions since I had done some work on a new block cipher API and I had wanted to submit an implementation to the distro. But when I heard there was no hope of including it, I stopped working on

Re: Zen of Python

2005-01-22 Thread Arthur
On 21 Jan 2005 20:32:46 -0800, Paul Rubin http://[EMAIL PROTECTED] wrote: Of course in that case, since the absence of lexical scope was a wart in its own right, fixing it had to have been on the radar. So turning the persistent listcomp loop var into a documented feature, instead of describing

Re: What YAML engine do you use?

2005-01-22 Thread Steve Holden
Bengt Richter wrote: On Fri, 21 Jan 2005 12:04:10 -0600, A.M. Kuchling [EMAIL PROTECTED] wrote: On Fri, 21 Jan 2005 18:30:47 +0100, rm [EMAIL PROTECTED] wrote: Nowadays, people are trying to create binary XML, XML databases, graphics in XML (btw, I'm quite impressed by SVG), you have XSLT,

Re: rotor replacement

2005-01-22 Thread Paul Rubin
A.M. Kuchling [EMAIL PROTECTED] writes: It was discussed in this thread: http://mail.python.org/pipermail/python-dev/2003-April/034959.html Guido and M.-A. Lemburg were leaning against including crypto; everyone else was positive. But Guido's the BDFL, so I interpreted his vote as being the

Re: Zen of Python

2005-01-22 Thread Andrew Koenig
Fredrik Lundh [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] in some early C++ compilers, the scope for x was limited to the scope containing the for loop, not the for loop itself. some commercial compilers still default to that behaviour. Indeed--and the standards committee

Re: Zen of Python

2005-01-22 Thread Andrew Koenig
Paul Rubin http://[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] It's really irrelevant whether anyone is using a feature or not. If the feature is documented as being available, it means that removing it is an incompatible change that can break existing code which currently

Re: Zen of Python

2005-01-22 Thread Paul Rubin
Andrew Koenig [EMAIL PROTECTED] writes: In this case, I think the right solution to the problem is two-fold: 1) from __future__ import lexical_comprehensions 2) If you don't import the feature, and you write a program that depends on a list-comprehension variable remaining in

Re: Zen of Python

2005-01-22 Thread Andrew Koenig
Paul Rubin http://[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] It's not obvious to me how the compiler can tell. Consider: x = 3 if frob(): frobbed = True squares = [x*x for x in range(9)] if blob(): z = x Should the compiler issue a warning

Re: Reload Tricks

2005-01-22 Thread Michael Spencer
Kamilche wrote: I want my program to be able to reload its code dynamically. I have a large hierarchy of objects in memory. The inheritance hierarchy of these objects are scattered over several files. Michael Spencer wrote: An alternative approach (with some pros and cons) is to modify the class

Re: Zen of Python

2005-01-22 Thread Paul Rubin
Andrew Koenig [EMAIL PROTECTED] writes: Actually, I don't think so. If you intend for it to be impossible for z = x to refer to the x in the list comprehension, you shouldn't mind putting in from __future__ import lexical_comprehensions. If you don't intend for it to be impossible, then

Re: finding name of instances created

2005-01-22 Thread Scott David Daniels
Andr Roberge wrote: Craig Ringer wrote: On Fri, 2005-01-21 at 16:13 -0800, Andr wrote: Short version of what I am looking for: Given a class public_class which is instantiated a few times e.g. a = public_class() b = public_class() c = public_class() I would like to find out the name of the

Re: [OT] Good C++ book for a Python programmer

2005-01-22 Thread Ville Vainio
Rick == rick [EMAIL PROTECTED] com [EMAIL PROTECTED] writes: Rick I was wondering whether anyone could recommend a good C++ Rick book, with good being defined from the perspective of a Rick Python programmer. I A good C++ book from the perspective of a Python programmer would be one

Re: list unpack trick?

2005-01-22 Thread aurora
Thanks. I'm just trying to see if there is some concise syntax available without getting into obscurity. As for my purpose Siegmund's suggestion works quite well. The few forms you have suggested works. But as they refer to list multiple times, it need a separate assignment statement like

Re: rotor replacement

2005-01-22 Thread Fredrik Lundh
Paul Rubin wrote: 2. Would anyone except me have any use for this? shows a lack of understanding of how Python is used. Some users (call them application users or AU's) use Python to run Python applications for whatever purpose. Some other users (call them developers) use Python to develop

Re: Class introspection and dynamically determining function arguments

2005-01-22 Thread Mike C. Fletcher
Bengt Richter wrote: On Fri, 21 Jan 2005 20:23:58 -0500, Mike C. Fletcher [EMAIL PROTECTED] wrote: On Thu, 20 Jan 2005 11:24:12 -, Mark English [EMAIL PROTECTED] wrote: ... Does the BasicProperty base class effectively register itself as an observer of subclass properties and

Re: embedding jython in CPython...

2005-01-22 Thread Steve Menard
Jim Hargrave wrote: I've read that it is possible to compile jython to native code using GCJ. PyLucene uses this approach, they then use SWIG to create a Python wrapper around the natively compiled (java) Lucene. Has this been done before for with jython? Another approach would be to use JPype

Re: rotor replacement

2005-01-22 Thread Paul Rubin
Fredrik Lundh [EMAIL PROTECTED] writes: lack of understanding of how Python is used wonderful. I'm going to make a poster of your post, and put it on my office wall. Excellent. I hope you will re-read it several times a day. Doing that might improve your attitude. --

Re: rotor replacement

2005-01-22 Thread Fredrik Lundh
Paul Rubin wrote: Excellent. I hope you will re-read it several times a day. Doing that might improve your attitude. you really don't have a fucking clue about anything, do you? /F -- http://mail.python.org/mailman/listinfo/python-list

Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
Fredrik Lundh wrote: A.M. Kuchling wrote: IMHO that's a bit extreme. Specifications are written to be detailed, so consequently they're torture to read. Seen the ReStructured Text spec lately? I've read many specs; YAML (both the spec and the format) is easily among the worst ten-or-so specs

Re: default value in a list

2005-01-22 Thread Nick Craig-Wood
Alex Martelli [EMAIL PROTECTED] wrote: Nick Craig-Wood [EMAIL PROTECTED] wrote: ... Or this version if you want something other than as the default a, b, b = (line.split(':') + 3*[None])[:3] Either you mean a, b, c -- or you're being subtler than I'm grasping. Just a typo -

Re: What YAML engine do you use?

2005-01-22 Thread rm
Doug Holton wrote: What do you expect? YAML is designed for humans to use, XML is not. YAML also hasn't had the backing and huge community behind it like XML. XML sucks for people to have to write in, but is straightforward to parse. The consequence is hordes of invalid XML files, leading to

Re: default value in a list

2005-01-22 Thread Michael Spencer
Alex Martelli wrote: [explanation and the following code:] a, b, c = it.islice( ... it.chain( ... line.split(':'), ... it.repeat(some_default), ... ), ... 3) ... ... def pad_with_default(N, iterable,

Re: default value in a list

2005-01-22 Thread Reinhold Birkenfeld
Michael Spencer wrote: Alex Martelli wrote: [explanation and the following code:] a, b, c = it.islice( ... it.chain( ... line.split(':'), ... it.repeat(some_default), ... ), ... 3) ... ...

Re: What YAML engine do you use?

2005-01-22 Thread Fredrik Lundh
rm [EMAIL PROTECTED] wrote: 100% right on, stuff (like this)? should be easy on the users, and if possible, on the developers, not the other way around. I guess you both stopped reading before you got to the second paragraph in my post. YAML (at least the version described in that spec)

Re: What YAML engine do you use?

2005-01-22 Thread rm
Fredrik Lundh wrote: rm [EMAIL PROTECTED] wrote: 100% right on, stuff (like this)? should be easy on the users, and if possible, on the developers, not the other way around. I guess you both stopped reading before you got to the second paragraph in my post. YAML (at least the version described

Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
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 bandwidth). What's right for

Re: What YAML engine do you use?

2005-01-22 Thread Doug Holton
rm wrote: this implementation of their idea. But I'd love to see a generic, pythonic data format. That's a good idea. But really Python is already close to that. A lot of times it is easier to just write out a python dictionary than using a DB or XML or whatever. Python is already close to

Re: rotor replacement

2005-01-22 Thread Paul Rubin
Fredrik Lundh [EMAIL PROTECTED] writes: Excellent. I hope you will re-read it several times a day. Doing that might improve your attitude. you really don't have a fucking clue about anything, do you? You're not making any bloody sense. I explained to you why I wasn't interested in

Re: What YAML engine do you use?

2005-01-22 Thread Fredrik Lundh
rm [EMAIL PROTECTED] wrote: furthermore, users will suffer too, I'm suffering if I have to use C++, with all its exceptions and special cases. and when you suffer, your users will suffer. in the C++ case, they're likely to suffer from spurious program crashes, massively delayed development

Re: What YAML engine do you use?

2005-01-22 Thread Daniel Bickett
Doug Holton wrote: What do you expect? YAML is designed for humans to use, XML is not. YAML also hasn't had the backing and huge community behind it like XML. XML sucks for people to have to write in, but is straightforward to parse. The consequence is hordes of invalid XML files, leading to

Re: IDLE Problem in Windows XP

2005-01-22 Thread Josiah Carlson
Branden Smith [EMAIL PROTECTED] wrote: Hi, I am a teaching assistant for an introductory course at Georgia Tech which uses Python, and I have a student who has been unable to start IDLE on her Windows XP Home Edition machine. Clicking on the shortcut (or the program executable) causes

Re: getting file size

2005-01-22 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Bob Smith 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

Re: What YAML engine do you use?

2005-01-22 Thread Paul Rubin
Daniel Bickett [EMAIL PROTECTED] writes: 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). YAML looks to me to be completely insane, even compared to Python lists.

Re: What YAML engine do you use?

2005-01-22 Thread Stephen Waterbury
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 (unless I'm mistaken) as a process-to-process data interchange metalanguage that would be *human_readable*. The premise that XML

Re: What YAML engine do you use?

2005-01-22 Thread rm
Doug Holton wrote: rm wrote: this implementation of their idea. But I'd love to see a generic, pythonic data format. That's a good idea. But really Python is already close to that. A lot of times it is easier to just write out a python dictionary than using a DB or XML or whatever. Python

Re: What YAML engine do you use?

2005-01-22 Thread Fredrik Lundh
Stephen Waterbury wrote: The premise that XML had a coherent design intent stetches my credulity beyond its elastic limit. the design goals are listed in section 1.1 of the specification. see tim bray's annotated spec for additional comments by one of the team members:

Re: What YAML engine do you use?

2005-01-22 Thread Alex Martelli
Paul Rubin http://[EMAIL PROTECTED] wrote: ... lists. I think it would be great if the Python library exposed an interface for parsing constant list and dict expressions, e.g.: [1, 2, 'Joe Smith', 8237972883334L, # comment {'Favorite fruits': ['apple', 'banana', 'pear']}, #

Re: What YAML engine do you use?

2005-01-22 Thread Michael Spencer
Paul Rubin wrote: YAML looks to me to be completely insane, even compared to Python lists. I think it would be great if the Python library exposed an interface for parsing constant list and dict expressions, e.g.: [1, 2, 'Joe Smith', 8237972883334L, # comment {'Favorite fruits':

Re: What YAML engine do you use?

2005-01-22 Thread Fredrik Lundh
Alex Martelli wrote: [1, 2, 'Joe Smith', 8237972883334L, # comment {'Favorite fruits': ['apple', 'banana', 'pear']}, # another comment 'xyzzy', [3, 5, [3.14159, 2.71828, [ I don't see what YAML accomplishes that something like the above wouldn't. Note that all the

debugging process

2005-01-22 Thread jimbo
Hi, I am trying to create a separate process that will launch python and then can be used to step through a script programmatically. I have tried something like: (input, output) = os.popen2(cmd=python) Then I expected I could select over the two handles input and output, make sure they aren't

Re: rotor replacement

2005-01-22 Thread John J. Lee
Paul Rubin http://phr.cx@NOSPAM.invalid writes: [...] Building larger ones seems to have complexity exponential in the number of bits, which is not too [...] Why? It's not even known in theory whether quantum computing is possible on a significant scale. Discuss. wink (I don't mean I'm

Re: What YAML engine do you use?

2005-01-22 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: I wonder, however, if, as an even toyer exercise, one might not already do it easily -- by first checking each token (as generated by tokenize.generate_tokens) to ensure it's safe, and THEN eval _iff_ no unsafe tokens were found in the check. I don't

Re: rotor replacement

2005-01-22 Thread Paul Rubin
[EMAIL PROTECTED] (John J. Lee) writes: Building larger ones seems to have complexity exponential in the number of bits, which is not too Why? The way I understand it, that 7-qubit computer was based on embedding the qubits on atoms in a large molecule, then running the computation

RFC: Python bindings to Linux i2c-dev

2005-01-22 Thread Mark M. Hoffman
://members.dca.net/mhoffman/sensors/python/20050122/ [2] http://archives.andrew.net.au/lm-sensors/msg28792.html [3] http://www2.lm-sensors.nu/~lm78/cvs/lm_sensors2/doc/useful_addresses.html Thanks and regards, -- Mark M. Hoffman [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: [perl-python] 20050121 file reading writing

2005-01-22 Thread Bob Smith
Xah Lee wrote: # reading entire file as a list, of lines # mylist = f.readlines() To do this efficiently on a large file (dozens or hundreds of megs), you should use the 'sizehint' parameter so as not to use too much memory: sizehint = 0 mylist = f.readlines(sizehint) --

Re: debugging process

2005-01-22 Thread Alex Martelli
[EMAIL PROTECTED] wrote: ... I think that this must have something to do with python expecting itself to by in a TTY? Can anyone give any idea of where I should be going with this? http://pexpect.sourceforge.net/ Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: need help on need help on generator...

2005-01-22 Thread Terry Reedy
Francis Girard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If I understand correctly, Almost... a generator produce something over which you can iterate with the help of an iterator. To be exact, the producer is a generator function, a function whose body contains 'yield'.

Re: What YAML engine do you use?

2005-01-22 Thread Tim Parkin
Doug Holton wrote: 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 bandwidth). What's right for developers is what requires the least amount of work. The problem is, that's what

Re: rotor replacement

2005-01-22 Thread Paul Rubin
A.M. Kuchling [EMAIL PROTECTED] writes: It was discussed in this thread: http://mail.python.org/pipermail/python-dev/2003-April/034959.html In that thread, you wrote: Rubin wanted to come up with a nice interface for the module, and has posted some notes toward it. I have an existing

Re: finding name of instances created

2005-01-22 Thread André
Steven Bethard wrote: If you have access to the user module's text, something like this might be a nicer solution: py class Robot(object): ... def __init__(self): ... self.name = None ... def move(self): ... print robot %r moved % self.name ... py class

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

2005-01-22 Thread Stephen Waterbury
Fredrik Lundh wrote: Stephen Waterbury wrote: The premise that XML had a coherent design intent stetches my credulity beyond its elastic limit. the design goals are listed in section 1.1 of the specification. see tim bray's annotated spec for additional comments by one of the team members:

Re: rotor replacement

2005-01-22 Thread Fredrik Lundh
Paul Rubin wrote: you really don't have a fucking clue about anything, do you? 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. /F

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

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

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 it

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 easy

  1   2   >