Re: New Bee

2006-01-20 Thread phildini
One great place to start is the Python documentation website (http://www.python.org/doc/). They have soe very good basic info, both third-party tutorials as well as a tutorial writeen bu Guido Van Rossum (creator of Python). Guido's tutorial expects programming experience, so if you are a true begi

Re: Decimal vs float

2006-01-20 Thread Kay Schluehr
Steven D'Aprano wrote: > On Sat, 21 Jan 2006 03:48:26 +, Steve Holden wrote: > > > Steven D'Aprano wrote: > >> On Fri, 20 Jan 2006 04:25:01 +, Bengt Richter wrote: > >> > >> > >>>On Thu, 19 Jan 2006 12:16:22 +0100, =?ISO-8859-1?Q?Gerhard_H=E4ring?= > >>><[EMAIL PROTECTED]> wrote: > >>>[...

New Bee

2006-01-20 Thread Prasanna
Hi all, I am new to this group.I am willing to learn PYTHON can anyone suggest me where to start.I have installed PYTHON 2.4 windows platform.Where can I get books for beginners.How to go about?.It would be helpful if anyone is will to guide me. Thanks and Regards, Prasanna -- http://mail.python

Python shell interpreting delete key as tilde?

2006-01-20 Thread Leif K-Brooks
I'm running Python 2.3.5 and 2.4.1 under Debian Sarge. Instead of deleting the character after the cursor, pressing my "delete" key in an interactive Python window causes a system beep and inserts a tilde character. This behavior occurs across all of the terminals I've tried (xterm, Konsole, real L

Re: Firefox bug in webbrowser module on Ubuntu?!

2006-01-20 Thread ncf
This section is the cause of the problem: for browser in ("mozilla-firefox", "mozilla-firebird", "mozilla", "netscape"): if _iscommand(browser): register(browser, None, Netscape(browser)) It's trying to load "mozilla-firefox" as the exec

Re: Problem with running external process

2006-01-20 Thread Donn Cave
Quoth "ToMasz" <[EMAIL PROTECTED]>: | There is a script running continuously which executes an external | script in a loop using os.spawnlp(os.P_WAIT, 'extscript.py') function. | After several hundred executions (cycles of the loop), the main script | gets an exception while trying to start the pro

Re: sockets

2006-01-20 Thread Allan Zhang
> >> the following code works perfectly >> import socket, sys >> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >> s.connect(("www.python.org", 80)) >> s.send("GET") here, You need to speak HTTP protocol. I would suggest to change s.send( "GET / HTTP/1.0\x0d\x0a\x0d\x0a" ) >> whi

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-20 Thread Tim Peters
[Claudio Grondi] >> Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32 - IDLE 1.1.2 >> >>> a=[] >> >>> a.append(a) >> >>> b=[] >> >>> b.append(b) >> >>> a==b >> >> Traceback (most recent call last): >>File "", line 1, in -toplevel- >> a==b >> RuntimeError:

Re: Decimal vs float

2006-01-20 Thread Steven D'Aprano
On Sat, 21 Jan 2006 03:48:26 +, Steve Holden wrote: > Steven D'Aprano wrote: >> On Fri, 20 Jan 2006 04:25:01 +, Bengt Richter wrote: >> >> >>>On Thu, 19 Jan 2006 12:16:22 +0100, =?ISO-8859-1?Q?Gerhard_H=E4ring?= >>><[EMAIL PROTECTED]> wrote: >>>[...] >>> floating points are always i

Re: OT: excellent book on information theory

2006-01-20 Thread Grant Edwards
On 2006-01-21, Paul Rubin wrote: >> The next thing you know, there are going to be American >> translations of Jane Austen where a girl says to her sister >> "dude, he is such a hottie!" and she replies "oh my god, for >> sure!" > > I actually heard that the US film version of Pride and Prejudic

Re: Variables and none?

2006-01-20 Thread Steve Holden
Ivan Shevanski wrote: > Alright first of all I'd like to say I'm a python noob. > Welcome to c.l.py. > Now that thats over with, heres what I'd like to know about. Is there a > python way to detect if a variable exsists? Say I had a program that > needed a certain variable to be set to run an

Re: Variables and none?

2006-01-20 Thread Ivan Shevanski
On 1/20/06, Ivan Shevanski <[EMAIL PROTECTED]> wrote: Alright first of all I'd like to say I'm a python noob.Now that thats over with, heres what I'd like to know about.  Is there a python way to detect if a variable exsists?  Say I had a program that needed a certain variable to be set to run and

Re: OT: excellent book on information theory

2006-01-20 Thread Steve Holden
Grant Edwards wrote: > On 2006-01-21, Steven D'Aprano <[EMAIL PROTECTED]> wrote: [...] >>But the real question is why it is that American publishers >>believe their readers are so lazy and ignorant that they >>require special "translations" of British books. I don't know >>anyone who has said "I'm

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-20 Thread Steven D'Aprano
On Sat, 21 Jan 2006 01:12:28 +0100, Claudio Grondi wrote: > Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on > win32 - IDLE 1.1.2 > >>> a=[] > >>> a.append(a) > >>> b=[] > >>> b.append(b) > >>> a==b > > Traceback (most recent call last): >File "", line 1, in -top

Re: Decimal vs float

2006-01-20 Thread Steve Holden
Steven D'Aprano wrote: > On Fri, 20 Jan 2006 04:25:01 +, Bengt Richter wrote: > > >>On Thu, 19 Jan 2006 12:16:22 +0100, =?ISO-8859-1?Q?Gerhard_H=E4ring?= <[EMAIL >>PROTECTED]> wrote: >>[...] >> >>>floating points are always imprecise, so you wouldn't want them as an >> >>Please, floating po

Re: Read from Serial Port

2006-01-20 Thread Grant Edwards
On 2006-01-21, Casey Bralla <[EMAIL PROTECTED]> wrote: > I'd like to read ASCII data from a serial port, but (once > again) I'm having trouble getting started. (Can't seem to > find the basic level of docs to get going ) > > I'd like to use only standard "built-in" modules if possible. Then ther

Variables and none?

2006-01-20 Thread Ivan Shevanski
Alright first of all I'd like to say I'm a python noob.Now that thats over with, heres what I'd like to know about.  Is there a python way to detect if a variable exsists?  Say I had a program that needed a certain variable to be set to run and the variable was not found when it came time to use it

Re: Read from Serial Port

2006-01-20 Thread Steve Holden
Casey Bralla wrote: > I'd like to read ASCII data from a serial port, but (once again) I'm having > trouble getting started. (Can't seem to find the basic level of docs to > get going ) > > I'd like to use only standard "built-in" modules if possible. > > Could somebody offer a simple code-snipp

Re: OT: excellent book on information theory

2006-01-20 Thread Paul Rubin
Grant Edwards <[EMAIL PROTECTED]> writes: > The next thing you know, there are going to be American > translations of Jane Austin where a girl says to her sister > "dude, he is such a hottie!" and she replies "oh my god, for > sure!" I actually heard that the US film version of Pride and Prejudic

Re: Decimal vs float

2006-01-20 Thread Steven D'Aprano
On Fri, 20 Jan 2006 04:25:01 +, Bengt Richter wrote: > On Thu, 19 Jan 2006 12:16:22 +0100, =?ISO-8859-1?Q?Gerhard_H=E4ring?= <[EMAIL > PROTECTED]> wrote: > [...] >> >>floating points are always imprecise, so you wouldn't want them as an > Please, floating point is not "always imprecise." In

Re: OT: excellent book on information theory

2006-01-20 Thread Steve Holden
Steven D'Aprano wrote: > On Thu, 19 Jan 2006 14:12:24 +0200, Juho Schultz wrote: > > >>Because the intended audience is probably reads formulas better than >>they read Python. The 1st sentence of the Introduction: "This book is >>aimed at senior undergraduates and graduate students in Engineerin

Re: OT: excellent book on information theory

2006-01-20 Thread Grant Edwards
On 2006-01-21, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> One question here is: Are US English and UK English different languages >> or not? If they are, a translation is in place. If they are not, the >> text should have been left as is. I guess the answer is: >> -Well, sort of... > > That's

Re: why is my hash being weird??

2006-01-20 Thread Steven D'Aprano
On Thu, 19 Jan 2006 18:59:11 -0800, pycraze wrote: > Surely adopting the above method is much better than what i have > approached earlier . The main reason i did adopt this exercise was when > i have to marshal a 20 - 40 MB above test.py file to the disk , the > simple load of the test.py will sk

Re: Is there a maximum length of a regular expression in python?

2006-01-20 Thread Steve Holden
Tim Peters wrote: > [Bryan Olson] > >>>Does no one care about an internal error in the regular expression >>>engine? > > > [Steve Holden] > >>Not one that requires parsing a 100 kilobyte re that should be replaced >>by something more sensible, no. > > > I care: this is a case of not detectin

Re: [OT] Nit: please don't user "it's" unless you can substitute "it is" without changing your inteded meaning.

2006-01-20 Thread Steven D'Aprano
On Fri, 20 Jan 2006 07:06:29 +, Tim Roberts wrote: > My own name gives me trouble with this. There is disagreement in the > curmudgeon world as to whether I should refer to "the Roberts' computer", > or "the Roberts's computer". > > I guess I'll just have to keep saying "that damn computer."

Read from Serial Port

2006-01-20 Thread Casey Bralla
I'd like to read ASCII data from a serial port, but (once again) I'm having trouble getting started. (Can't seem to find the basic level of docs to get going ) I'd like to use only standard "built-in" modules if possible. Could somebody offer a simple code-snippet to get me started reading from

Re: Python code written in 1998, how to improve/change it?

2006-01-20 Thread Steven D'Aprano
On Fri, 20 Jan 2006 10:27:58 +1300, Carl Cerecke wrote: > We want a goto. > > Unfortunately, this is about the only problem I can think of where gotos > are useful. And for reasons well explained elsewhere, gotos are Not Good. > > I've solved this in a very efficient, but rather unpythonic way.

Re: Problem with running external process

2006-01-20 Thread Chmouel Boudjnah
see the help for ulimit (builtils) : -$ help limit -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a maximum length of a regular expression in python?

2006-01-20 Thread Tim Peters
[Bryan Olson] >> Does no one care about an internal error in the regular expression >> engine? [Steve Holden] > Not one that requires parsing a 100 kilobyte re that should be replaced > by something more sensible, no. I care: this is a case of not detecting information loss due to unchecked down

Re: Is there a maximum length of a regular expression in python?

2006-01-20 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > > > Does no one care about an internal error in the regular expression > > > engine? > > > > > Not one that requires parsing a 100 kilobyte re that should be > > replaced by s

Re: Why optparse wont import?

2006-01-20 Thread Steve Holden
Karlo Lozovina wrote: > Jorge Godoy <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > > >>Rename your file to something other than optparse.py... > > > Oh my :(... I'm so ashamed :). > Don't worry. If this list had a FAQ, that would be on it. You are by no means the first ... regards

Re: Is there a maximum length of a regular expression in python?

2006-01-20 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > > Does no one care about an internal error in the regular expression > > engine? > > > Not one that requires parsing a 100 kilobyte re that should be > replaced by something more sensible, no. If the internal error means the re engine bumped into some int

Re: How to generate graphics dynamically on the web using Python CGI script?

2006-01-20 Thread chris
This is a cool product that can produce any number of types of graphs. Supports Python, as well as lots of other languages. I have used it with success. There is a free version, as long as you don't mind the tiny logo they put into each graph. http://www.advsofteng.com/ -Chris -- http://mail.

Re: OT: excellent book on information theory

2006-01-20 Thread Steven D'Aprano
On Thu, 19 Jan 2006 15:04:51 +0100, Mikael Olofsson wrote: > One question here is: Are US English and UK English different languages > or not? If they are, a translation is in place. If they are not, the > text should have been left as is. I guess the answer is: > -Well, sort of... That's the s

Re: Is there a maximum length of a regular expression in python?

2006-01-20 Thread Steve Holden
Bryan Olson wrote: > Roy Smith wrote: > >> [EMAIL PROTECTED] wrote: >> >> >> >>>I have a regular expression that is approximately 100k bytes. (It is >>>basically a list of all known norwegian postal numbers and the >>>corresponding place with | in between. I know this is not the intended >>>use fo

Re: How to generate graphics dynamically on the web using Python CGI script?

2006-01-20 Thread Steve Holden
David Wahler wrote: > Xavier Morel wrote: > >>Steve Holden wrote: >> >>>Luiz Geron wrote: >>> I don't have experience on this, but I think that you can make the script return the image "contents" directly to the img tag, without passing it to a img file, so you can use something like t

Re: OT: excellent book on information theory

2006-01-20 Thread Paul Rubin
"Anton Vredegoor" <[EMAIL PROTECTED]> writes: > Returning to the original book, why did they write a lot of it (at > least the first few pages until I gave up, after having trouble > understanding formulas about concepts I have no such trouble with when > framed in less jargonized from) in unintell

Re: OT: excellent book on information theory

2006-01-20 Thread Steven D'Aprano
On Thu, 19 Jan 2006 14:12:24 +0200, Juho Schultz wrote: > Because the intended audience is probably reads formulas better than > they read Python. The 1st sentence of the Introduction: "This book is > aimed at senior undergraduates and graduate students in Engineering, > Science, Mathematics and

Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-20 Thread Robert Kern
Claudio Grondi wrote: > I decided to use numarray, so maybe you can report what your problem/bug > is before I run into it myself? The reason why I decided to use numarray > was, that the whole scpy_core story seems to get more or less commercial > and its free version comes because of this wit

Off Topic (OT) Message

2006-01-20 Thread Bob Harding
  We are looking for a 1981 graduate from Gaithersburg High School, Maryland. We believe he may frequent this list, hence this post. Please contact us at [EMAIL PROTECTED]. Thank you. Bob/Mary Harding -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: excellent book on information theory

2006-01-20 Thread Steven D'Aprano
On Thu, 19 Jan 2006 03:20:04 -0800, Anton Vredegoor wrote: > The old trick of 'but there are some things > that cannot be expressed in any other way than by using formulas' > doesn't get one many optimization points in my world. Alas, your world is not as precise and accurate as the world of math

Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-20 Thread Robert Kern
J wrote: > Hi > > I hope the title of this message indicates my question. I am looking > for basic > array functionality in Python and it turns out that there are all these > packages which > are somehow related. Some are allegedly discontinued but still seem to > get updated. Could we start a dis

Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-20 Thread Claudio Grondi
J wrote: > Hi > > I hope the title of this message indicates my question. I am looking > for basic > array functionality in Python and it turns out that there are all these > packages which > are somehow related. Some are allegedly discontinued but still seem to > get updated. Could we start a dis

Numarray, numeric, NumPy, scpy_core ??!!

2006-01-20 Thread J
Hi I hope the title of this message indicates my question. I am looking for basic array functionality in Python and it turns out that there are all these packages which are somehow related. Some are allegedly discontinued but still seem to get updated. Could we start a discussion about which packa

Re: Is the Python binding for ncurses unicode capable?

2006-01-20 Thread Martin v. Löwis
[EMAIL PROTECTED] wrote: > I don't have any problems with simply printing the characters from > Python (outside of ncurses), but using the ncurses functions for > printing these characters is problematic. I see. I can't get this to work, either, and neither with libncursesw. Regards, Martin -- h

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-20 Thread Claudio Grondi
Steven D'Aprano wrote: > On Thu, 19 Jan 2006 10:08:38 +0100, Claudio Grondi wrote: > > >>The point is to find a way to create in Python two indentifiers a and b >>without manipulating any of the __eq__ and to __eq__ related functions >>in a way, that the simple >> if a==b: print 'a==b' >>stat

Re: Why optparse wont import?

2006-01-20 Thread Karlo Lozovina
Jorge Godoy <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Rename your file to something other than optparse.py... Oh my :(... I'm so ashamed :). -- ___Karlo Lozovina - Mosor | | |.-.-. web: http://www.mosor.net || ICQ#: 106

Re: python & camera

2006-01-20 Thread Peter Hansen
Alex Gittens wrote: > I'm working on a final project for my EE degree that requires the use > of digital camera with high resolution. I'd like to do the image > capture with Python, preferably in a cross-platform manner, but if > necessary, we can limit ourselves to Windows. Any ideas on > modules/

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-20 Thread Steven D'Aprano
On Thu, 19 Jan 2006 10:08:38 +0100, Claudio Grondi wrote: > The point is to find a way to create in Python two indentifiers a and b > without manipulating any of the __eq__ and to __eq__ related functions > in a way, that the simple >if a==b: print 'a==b' > statement results in an endless lo

Re: Strange python behavior with modules on an emt64 box

2006-01-20 Thread Tim Peters
[Joshua Luben] > I thought I would post this here first before seeking more experienced ears > for this particular strangness. > > I have Python 2.4.2 installed from source on a dual processor dell server. > These are x86_64 processors (verified by /bin/arch) (aka emt64 extensions). > > uname -a gi

Re: Python code written in 1998, how to improve/change it?

2006-01-20 Thread Bengt Richter
On Thu, 19 Jan 2006 23:16:57 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: >Carl Cerecke wrote: >> Carl Cerecke wrote: >>>Ah. Well, my post suggested, as one option, the callables call >>>each other directly. >> >> Doh! No I didn't. And they shouldn't. Otherwise the call stack >> gets out of han

Re: saxutils.XMLGenerator and CDATA

2006-01-20 Thread Robert Kern
chris wrote: > Confused somewhat xml newbie. I'm trying to output xml with a CDATA > section, using saxutils.XMLGenerator, but the output contains escaped > '<' and '>' and '&' from the CDATA element. Shouldn't it be spit out > intact? > > Here's code and output: > > from xml.sax import saxuti

Re: Why optparse wont import?

2006-01-20 Thread Jorge Godoy
Karlo Lozovina <[EMAIL PROTECTED]> writes: > If I create a file with only one line: > > --- > from optparse import OptionParser > --- > > I get this when I try to run it from "DOS" prompt: > > Traceback (most recent call last): > File "optparse.py", line 1, in ? > from optparse import Option

Re: ConfigParser: writes a list but reads a string?

2006-01-20 Thread funkyj
I'm interested in the same sort of config file issues. Unfortunately the restricted execution has fallen out of favor. My preferred solution would be to have a configEval() function that is just like the regular Python eval() but only accepts a subset of the python language, e.g. creating the bas

Why optparse wont import?

2006-01-20 Thread Karlo Lozovina
If I create a file with only one line: --- from optparse import OptionParser --- I get this when I try to run it from "DOS" prompt: Traceback (most recent call last): File "optparse.py", line 1, in ? from optparse import OptionParser File "X:\data\other\source\python\population\optparse.

Re: Firefox bug in webbrowser module on Ubuntu?!

2006-01-20 Thread Paul Boddie
SPE - Stani's Python Editor wrote: > > During optimizing SPE for Ubuntu, I found something strange. I have > Ubuntu 5.10 "The Breezy Badger" and unfortunately this code is not > working: > > >>> import webbrowser > >>> webbrowser.open("http://www.python.org";) > > It does not throw an exception, bu

saxutils.XMLGenerator and CDATA

2006-01-20 Thread chris
Confused somewhat xml newbie. I'm trying to output xml with a CDATA section, using saxutils.XMLGenerator, but the output contains escaped '<' and '>' and '&' from the CDATA element. Shouldn't it be spit out intact? Here's code and output: from xml.sax import saxutils import sys handler = saxut

Re: Is the Python binding for ncurses unicode capable?

2006-01-20 Thread Martin v. Löwis
Thomas Dickey wrote: > Both libraries respond to locale. But ncurses only deals in single-byte > encodings, e.g., ISO-8859-1 through ISO-8859-15. ncursesw supports that, > but adds support for multi-byte encodings, e.g., UTF-8. For the latter, > one can also have characters that combine (a print

Re: Is the Python binding for ncurses unicode capable?

2006-01-20 Thread bmcnally
Can someone explain what I'm doing wrong? The following code snipet produces an error about addch() expecting an int: u = u'\u2591' s = u.encode("UTF-8") stdscr.addch((y+1), (x+1), s, curses.color_pair(1)) If I try this instead: u = u'\u2591' s = u.encode(

Re: python & camera

2006-01-20 Thread Claudio Grondi
Alex Gittens wrote: > I'm working on a final project for my EE degree that requires the use > of digital camera with high resolution. I'd like to do the image > capture with Python, preferably in a cross-platform manner, but if > necessary, we can limit ourselves to Windows. Any ideas on > modules/

Re: Arithmetic sequences in Python

2006-01-20 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > > How would you make a one-element list, which we'd currently write as [3]? > > Would you have to say list((3,))? > > Yep. I don't particularly like the "mandatory trailing comma" in the > tuple's display form, mind you, but, if it's good enough for tup

Re: list comprehention

2006-01-20 Thread Bryan Olson
Duncan Booth wrote: > Here's the way I would do it: > def occurrences(it): > > res = {} > for item in it: > if item in res: > res[item] += 1 > else: > res[item] = 1 > return res I slightly prefer: def occurrences(it): res = {} re

python & camera

2006-01-20 Thread Alex Gittens
I'm working on a final project for my EE degree that requires the use of digital camera with high resolution. I'd like to do the image capture with Python, preferably in a cross-platform manner, but if necessary, we can limit ourselves to Windows. Any ideas on modules/hardware for doing this? Than

Re: Is there a maximum length of a regular expression in python?

2006-01-20 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Bryan Olson <[EMAIL PROTECTED]> wrote: > Roy Smith wrote: > > [EMAIL PROTECTED] wrote: > > > > > >>I have a regular expression that is approximately 100k bytes. (It is > >>basically a list of all known norwegian postal numbers and the > >>corresponding place wit

Strange python behavior with modules on an emt64 box

2006-01-20 Thread Joshua Luben
I thought I would post this here first before seeking more experienced ears for this particular strangness.   I have Python 2.4.2 installed from source on a dual processor dell server. These are x86_64 processors (verified by /bin/arch) (aka emt64 extensions).   uname -a gives Linux eps-li

Re: Is there a maximum length of a regular expression in python?

2006-01-20 Thread Bryan Olson
Roy Smith wrote: > [EMAIL PROTECTED] wrote: > > >>I have a regular expression that is approximately 100k bytes. (It is >>basically a list of all known norwegian postal numbers and the >>corresponding place with | in between. I know this is not the intended >>use for regular expressions, but it s

Re: Redirecting standard out in a single namespace

2006-01-20 Thread Ido Yehieli
I'm sorry, but i don't see how this will solve the problem? It is exactly the same, only now you've replaced everything in sys except just sys.stdout? At any rate, perhapse the code you will write will be more maintainable if instead of redirecting sys.stdout for some of the code just use a differe

Re: Extended List Comprehension

2006-01-20 Thread Paul Rubin
Tim Chase <[EMAIL PROTECTED]> writes: > > You could (in 2.5) use: > >[(x if x%2 else 'even') for x in '1234'] > > This failed on multiple levels in 2.3.5 (the "if" syntax is > unrecognized, Yes, that syntax is new to 2.5. > However, this worked in my 2.3.5: > [((x%2 == 0 and 'even') or x

Re: Extended List Comprehension

2006-01-20 Thread Joel Bender
> You could (in 2.5) use: > >[(x if x%2 else 'even') for x in '1234'] Or this: [int(x)&1 and x or 'even' for x in '1234'] -- http://mail.python.org/mailman/listinfo/python-list

Re: Extended List Comprehension

2006-01-20 Thread Ido Yehieli
As Paul already demonstrated, this is hardly needed since it can be done more clearly with existing lang. features. -- http://mail.python.org/mailman/listinfo/python-list

Re: Extended List Comprehension

2006-01-20 Thread Tim Chase
>>py> [x for x in '1234' if x%2 else 'even'] >>[1, 'even', 3, 'even'] >> >>I'm guessing this has been suggested before? > > > You could (in 2.5) use: > >[(x if x%2 else 'even') for x in '1234'] This failed on multiple levels in 2.3.5 (the "if" syntax is unrecognized, and trying the below w

Re: Extended List Comprehension

2006-01-20 Thread James Stroud
James Stroud wrote: > Would anyone else find this syntax useful for generator expressions? > > py> [x for x in '1234' if x%2 else 'even'] > [1, 'even', 3, 'even'] > > I'm guessing this has been suggested before? > > James Before anyone notices, I should say: [x for x in [1,2,3,4] if x%2 else '

Re: Extended List Comprehension

2006-01-20 Thread Paul Rubin
James Stroud <[EMAIL PROTECTED]> writes: > py> [x for x in '1234' if x%2 else 'even'] > [1, 'even', 3, 'even'] > > I'm guessing this has been suggested before? You could (in 2.5) use: [(x if x%2 else 'even') for x in '1234'] -- http://mail.python.org/mailman/listinfo/python-list

Re: PyXML: SAX vs. DOM

2006-01-20 Thread Matthias Kaeppler
Steven Bethard wrote: > I don't have an answer to your real question, but if you're not > committed to a particular XML package yet, you might consider ElementTree: > http://effbot.org/zone/element-index.htm > > The API is much simpler, and the package has a much more sane > organization. ;)

Extended List Comprehension

2006-01-20 Thread James Stroud
Would anyone else find this syntax useful for generator expressions? py> [x for x in '1234' if x%2 else 'even'] [1, 'even', 3, 'even'] I'm guessing this has been suggested before? James -- http://mail.python.org/mailman/listinfo/python-list

Re: Xah's Edu Corner: IT Industry Predicament

2006-01-20 Thread Keith Thompson
"Xah Lee" <[EMAIL PROTECTED]> writes: [the usual] ___ /| /| | | ||__|| | Please do | / O O\__ NOT | /

Re: PyXML: SAX vs. DOM

2006-01-20 Thread Steven Bethard
Matthias Kaeppler wrote: > I have to say I am confused about the documentation on pyxml.sf.net. > When I want to use DOM, I effectively am using a class called Sax2? ^^ > I also have to catch SAXExceptions, which reside in xml.sax._exceptions. > > I thought DOM and SAX are two completely different

Re: add pexpect to the standard library, standard "install" mechanism.

2006-01-20 Thread funkyj
Yeah, going back to the sourceforge site now I see the install instructions you quote above. Perhaps I'm spoiled by all the FSF packages I've dealt with over the years. In addition to being impatient I expect the README file to either tell me how to install the product or direct me to the INSTALL

Re: PyXML: SAX vs. DOM

2006-01-20 Thread Matthias Kaeppler
Oh and: Where can I find an API reference for PyXML? Am I supposed to /guess/ which methods and attributes e.g. Sax2 supplies? :D Thanks again, Matthias -- http://mail.python.org/mailman/listinfo/python-list

PyXML: SAX vs. DOM

2006-01-20 Thread Matthias Kaeppler
Hi, I have to say I am confused about the documentation on pyxml.sf.net. When I want to use DOM, I effectively am using a class called Sax2? ^^ I also have to catch SAXExceptions, which reside in xml.sax._exceptions. I thought DOM and SAX are two completely different things. Why is PyXML mixing

Re: MyHDL 0.5 released

2006-01-20 Thread Jan Decaluwe
Randall Parker wrote: > Jan, > > What do you see as the main advantage for using MyHDL rather than VHDL > for coding up a chip design? The fact that MyHDL is technically just another Python application. So it makes all typical Python advantages available to hardware designers. No need to discuss

Re: Redirecting standard out in a single namespace

2006-01-20 Thread Farshid Lashkari
Fuzzyman wrote: > Is there another way to shadow the sys module from a single namespace ? I've never actually tried this, but try making a copy of the sys module then replacing the stdout object with your own object. Then you can replace "sys" of the namespace with your custom "sys" module. I gu

Re: accessing hardware information using python

2006-01-20 Thread [EMAIL PROTECTED]
Johhny wrote: > I am currently looking to write a utility in python that will monitor > the statis of a RAID card within linux. The card in Question is the LSI > SAS1064 as the tools provided by the vendor to monitor the software > does not suit our requirements. What are your requirements? > How

Re: Xah's Edu Corner: IT Industry Predicament

2006-01-20 Thread Ulrich Hobelmann
Xah Lee wrote: > • The reason fucking languages like C and family mask technically Contrary to popular opinion, languages don't multiply. Certainly they don't have sex. Most (human) languages merely have something called gender, and words don't interact. C has a bastard child called C++, tru

Xah's Edu Corner: IT Industry Predicament

2006-01-20 Thread Xah Lee
IT Industry Predicament Xah Lee, 200207 As most of you agree, there are incredible wrongs in software industry. Programs crash, injurious tools, uninformed programers, and decrepit education system. Over the years of my computing industry experience since 1995, i have recently gradually come to r

Problem with running external process

2006-01-20 Thread ToMasz
There is a script running continuously which executes an external script in a loop using os.spawnlp(os.P_WAIT, 'extscript.py') function. After several hundred executions (cycles of the loop), the main script gets an exception while trying to start the process. This situation is repeated until the m

Re: zipfile and file permissions

2006-01-20 Thread Robert Kern
Pete Forman wrote: > I'm trying to move the building of a zip file from a shell script into > python. It is mostly working but when I unzip the files the UNIX > permissions are not preserved. The zip program I've been using is the > standard(?) one on Linux, from Info-Zip. Presumably I need to d

zipfile and file permissions

2006-01-20 Thread Pete Forman
I'm trying to move the building of a zip file from a shell script into python. It is mostly working but when I unzip the files the UNIX permissions are not preserved. The zip program I've been using is the standard(?) one on Linux, from Info-Zip. Presumably I need to do something with external_a

Firefox bug in webbrowser module on Ubuntu?!

2006-01-20 Thread SPE - Stani's Python Editor
Hi, During optimizing SPE for Ubuntu, I found something strange. I have Ubuntu 5.10 "The Breezy Badger" and unfortunately this code is not working: >>> import webbrowser >>> webbrowser.open("http://www.python.org";) It does not throw an exception, but is not able to launch a browser. Ubuntu shi

Bittorrent RPM Dependency Problem

2006-01-20 Thread Mark Sargent
Hi All, tried to install the RPM for bittorrent, and got the following, [EMAIL PROTECTED] bittorrent]# rpm -Uvh BitTorrent-4.2.2-1-Python2.3.noarch.rpm error: Failed dependencies: python(abi) = 2.3 is needed by BitTorrent-4.2.2-1.noarch [EMAIL PROTECTED] bittorrent]# python -V Python 2.3.4 why

Re: using arrow keys in the python shell on Mac OS X

2006-01-20 Thread [EMAIL PROTECTED]
You need libreadline to make it work. For some stupid reason OSX doesnt come with it installed. just get the gzipped one from here: http://www.pycs.net/bbum/2004/1/21/readline.so.gz then gunzip it and put the readline.so into /Library/Python/2.3/site-packages/ then fire up python again and it s

Re: Concurrency, I guess

2006-01-20 Thread dtecmeister
Sometimes creating files and separate processes are all that's needed. Write the settings into a config file with the web process and read them from the file with the sync process. Then create a second file at the start of the process and delete it once the process is complete. Lastly run a proced

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-20 Thread Claudio Grondi
Magnus Lycka wrote: > Claudio Grondi wrote: > >> You seem here to try to give a definition of the term 'value' for >> Python. If I understand it right, the definition of the term can't be >> generally given for many reasons. It depends at least on type and in >> advanced usage it can be arbitra

Re: How to generate graphics dynamically on the web using Python CGI script?

2006-01-20 Thread David Wahler
Xavier Morel wrote: > Steve Holden wrote: > > Luiz Geron wrote: > >> I don't have experience on this, but I think that you can make the > >> script return the image "contents" directly to the img tag, without > >> passing it to a img file, so you can use something like this: > >> > >> > >> > >> wi

Re: How to generate graphics dynamically on the web using PythonCGI script?

2006-01-20 Thread Fredrik Lundh
Xavier Morel wrote: > Generate inline base64 encoded images in your HTML page and you're done. > (yes, this is ugly, especially if you have a browser that don't support data: urls. -- http://mail.python.org/mailman/listinfo/python-list

Re: list(...) and list comprehensions (WAS: Arithmetic sequences in Python)

2006-01-20 Thread Rocco Moretti
Antoon Pardon wrote: > Well we could have list(a) return [a], and have a list_from_iterable. > Although I would prefer a different name. Or reverse it - list() always takes a single iterable, and list_from_scalars() is defined something like follows: >>> def list_from_scalars(*args): retu

Re: Howto create this XML string?

2006-01-20 Thread Fredrik Lundh
"Sbaush" wrote: > in the elementtree implementation the tostring function doesn't work with a > tree, work only with an element. What is the way to put the tree in a > string? this is the code you posted: root = ET.Element("manager") ... snip ... tree = ET.ElementTree(root) tree

Re: OT: introduction to computing clusters?

2006-01-20 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: > >Sorry for the off-topic post, but I know of no better collection of brains >than this one. I'm starting to investigate clustering as a means to address >some growing computing needs at work, but know essentially zip about the >concept.

ANN: FreeImagePy 1.2.0

2006-01-20 Thread Michele Petrazzo
FreeImagePy 1.2.0 is available at freeimagepy.sf.net What is? It' a python wrapper for FreeImage, Open Source library for developers who would like to support popular graphics image formats. How work? It use a binary freeimage library present on the system and ctypes. Major changes fro

Redirecting standard out in a single namespace

2006-01-20 Thread Fuzzyman
Hello, I'm trying to redirect standard out in a single namespace. I can replace sys.stdout with a custom object - but that affects all namespaces. There will be code running simultaneously that could import sys afterwards - so I don't want to make the change in the sys module. I have an idea to

  1   2   >