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 j

Comments in configuration files

2005-01-22 Thread Pierre Quentel
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 configuration file and edit

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( i

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!-)

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

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 o

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 va

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=xra

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

Re: rotor replacement

2005-01-22 Thread Nick Craig-Wood
Paul Rubin 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

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 th

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(): >

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 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 = (line+"::").s

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 c

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 th

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

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 config

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]) >

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?

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

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 > c

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 l

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 unde

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

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 - f

[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 loc

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'v

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 vari

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. -- http://mail.python.org/mailman/listinfo/python-

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 soft

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

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

Re: Zen of Python

2005-01-22 Thread Alex Martelli
Paul Rubin 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;

Re: Zen of Python

2005-01-22 Thread Alex Martelli
Paul Rubin 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 n

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 talki

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

Re: Zen of Python

2005-01-22 Thread Fredrik Lundh
Alex Martelli wrote: >> I do remember seeing some cute tricks (i.e. capable of becoming >> idioms) that depend on the leakage. > > Sure, ``if [mo for mo in [myre.search(line)] if mo]: use(mo)`` and the > like, used to simulate assign-and-test. here's an old favourite: lambda x: ([d for d in

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. -- http://mail.pyt

Re: rotor replacement

2005-01-22 Thread A.M. Kuchling
On 22 Jan 2005 04:50:30 -0800, 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 It was discussed in this thread: http://mail.python.org/pipermail/python-dev/2003-April/034959.htm

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

Re: Zen of Python

2005-01-22 Thread Arthur
On 21 Jan 2005 20:32:46 -0800, Paul Rubin 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 >descri

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 XSL

Re: rotor replacement

2005-01-22 Thread Paul Rubin
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > "I'll only work on stuff if I'm sure it's going right into the core" > isn't exactly a great way to develop good Python software. I > recommend the "would anyone except me have any use for this?" > approach. 1. Crypto is an important "battery" for man

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 b

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 com

Re: Zen of Python

2005-01-22 Thread Andrew Koenig
"Paul Rubin" 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 > current

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 rema

Re: Zen of Python

2005-01-22 Thread Andrew Koenig
"Paul Rubin" 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

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 in

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 impossi

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 inst

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

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

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. -- http://mail

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? -- 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 I'

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

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 n

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, iter

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 sp

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 descri

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 fo

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 YA

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

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 dev

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

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) c

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 r

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 lis

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 is

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: http://www.xml.co

Re: What YAML engine do you use?

2005-01-22 Thread Alex Martelli
Paul Rubin 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': ['apple

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 tha

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. (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 d

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 pr

RFC: Python bindings to Linux i2c-dev

2005-01-22 Thread Mark M. Hoffman
SMBus [3]. [1] http://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) -- http://mail.python.org

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

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

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> cl

[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: http

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

  1   2   >