[ANN] IronPython in Action available

2009-04-11 Thread Fuzzyman
After two and a half years of work IronPython in Action is finally available! http://www.ironpythoninaction.com/ IronPython in Action is the first book (in English anyway...) on IronPython. It is written by myself and my colleague Christian Muirhead, with a foreword by Jim Hugunin (the

Version 2.4 of mod_wsgi is now available.

2009-04-11 Thread Graham Dumpleton
Version 2.4 of mod_wsgi is now available. The software and documentation are both available from: http://www.modwsgi.org The mod_wsgi package consists of an Apache web server module designed and implemented specifically for hosting Python based web applications that support the WSGI interface

Re: How to create a virtual serial port?

2009-04-11 Thread Scott David Daniels
Stuart Davenport wrote: ... I'm on a OS X, python 2.5. Basically I will have a remote application pushing data (GPS) over the network to a python application I have running on my Mac, I want this python application to again push the data on to a virtual serial port. Then the GPS program I have

communication between objects - help

2009-04-11 Thread Murali kumar
thanks a lot.. I think passing the main object only by reference.. so, this does not causes any overhead.. am i correct..? On Fri, Apr 10, 2009 at 4:02 PM, Dave Angel da...@ieee.org wrote: Murali kumar wrote: hi all.. I'm posted in a word doc becoz to add a image to explain my problem..

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Joel Hedlund
Aaron Brady wrote: Would you be willing to examine a syntax tree to determine if there are any class accesses? Sure? How do I do that? I've never done that type of thing before so I can't really say if it would work or not. /Joel -- http://mail.python.org/mailman/listinfo/python-list

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Aaron Brady
On Apr 10, 7:54 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Thu, 09 Apr 2009 13:13:50 -0400, Terry Reedy wrote: Joel Hedlund wrote: Hi all! I'm writing a program that presents a lot of numbers to the user, and I want to let the user apply moderately simple

Re: weird try/finally behaviour

2009-04-11 Thread Aaron Brady
On Apr 10, 7:19 pm, Terry Reedy tjre...@udel.edu wrote: Sylvain Thénault wrote: Hi there, I've encountered the following behaviour which I found surprising: - If you say 'print test()', you shoud see None printed after 'end' (at least with 3.0) from the function falling off the end. The

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Joel Hedlund
Matt Nordhoff wrote: '\x5f' '_' getattr(42, '\x5f\x5fclass\x5f\x5f') # __class__ type 'int' Is that enough to show you the error of your ways? No, because print '_' in '\x5f\x5fclass\x5f\x5f' True :-D Cuz seriously, it's a bad idea. Yes probably, but that's not why. :-) (BTW: What

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Joel Hedlund
Matt Nordhoff wrote: '\x5f' '_' getattr(42, '\x5f\x5fclass\x5f\x5f') # __class__ type 'int' Is that enough to show you the error of your ways? No, because print '_' in '\x5f\x5fclass\x5f\x5f' True :-D Cuz seriously, it's a bad idea. Yes probably, but that's not why. :-) (BTW: What

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Peter Otten
Joel Hedlund wrote: Matt Nordhoff wrote: '\x5f' '_' getattr(42, '\x5f\x5fclass\x5f\x5f') # __class__ type 'int' Is that enough to show you the error of your ways? No, because print '_' in '\x5f\x5fclass\x5f\x5f' True But what you're planning to do seems more like def

Reading 3 objects at a time from list

2009-04-11 Thread Matteo
Hi all, let's see if there is a more pythonic way of doing what I'm trying to do. I have a lot of strings with numbers like this one: string = -1 1.3 100.136 1 2.6 100.726 1 3.9 101.464 -1 5.2 102.105 I need to pass the numbers to a function, but three at a time, until the string ends. The

Re: Reading 3 objects at a time from list

2009-04-11 Thread Chris Rebert
On Sat, Apr 11, 2009 at 1:44 AM, Matteo tadweles...@gmail.com wrote: Hi all, let's see if there is a more pythonic way of doing what I'm trying to do. I have a lot of strings with numbers like this one: string = -1 1.3 100.136 1 2.6 100.726 1 3.9 101.464 -1 5.2 102.105 I need to pass the

Re: How to create a virtual serial port?

2009-04-11 Thread Lawrence D'Oliveiro
In message e454b840-2361-413f- a8f9-145fa2845...@q2g2000vbr.googlegroups.com, Stuart Davenport wrote: Then the GPS program I have running on my MAC, RouteBuddy, can read the data from that serial port as standard. Macs don't have serial ports. --

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Joel Hedlund
Peter Otten wrote: But what you're planning to do seems more like def is_it_safe(source): ... return _ not in source ... source = getattr(42, '\\x5f\\x5fclass\\x5f\\x5f') if is_it_safe(source): ... print eval(source) ... type 'int' Bah. You are completely right of course. Just as

Re: An object that creates (nested) attributes automatically on assignment

2009-04-11 Thread John Machin
On Apr 11, 1:22 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Is pants slang for fragile, hard to understand and difficult to debug? pommy slang for sucks intensely, like the Deathstar's tractor beam ... I think we agree with him. --

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Peter Otten
Joel Hedlund wrote: Peter Otten wrote: But what you're planning to do seems more like def is_it_safe(source): ... return _ not in source ... source = getattr(42, '\\x5f\\x5fclass\\x5f\\x5f') if is_it_safe(source): ... print eval(source) ... type 'int' Bah. You are

Re: Python 2.6/3.0 packages for Ubuntu?

2009-04-11 Thread Francesco Bochicchio
s...@pobox.com ha scritto: Does Ubuntu really not have Python 2.6 or 3.0 packages or do I just have my package list misconfigured? I'm setting up a fresh machine and am not too Ubuntu-aware. Is there a list of package repositories around somewhere? Thx, In current 8.10, the default python

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Joel Hedlund
Peter Otten wrote: def is_it_safe(source): return _ not in source and r'\' not in source .join(map(chr, [95, 95, 110, 111, 95, 95])) '__no__' But you don't have access to neither map or chr? /Joel -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding a Badge to an Icon in Mac OS X

2009-04-11 Thread Cameron Simpson
On 10Apr2009 19:56, Miles semantic...@gmail.com wrote: | On Fri, Apr 10, 2009 at 5:22 PM, bingo wrote: | PyObjc seems to offer the option to add badges to icons in the doc. I | need to add badges to any icon... kinda like SCPlugin and dropbox do. | I think that SCPlugin is doing it through

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Peter Otten
Joel Hedlund wrote: Peter Otten wrote: def is_it_safe(source): return _ not in source and r'\' not in source .join(map(chr, [95, 95, 110, 111, 95, 95])) '__no__' But you don't have access to neither map or chr? /Joel '5f5f7374696c6c5f6e6f745f736166655f5f'.decode(hex)

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Joel Hedlund
Peter Otten wrote: Joel Hedlund wrote: Peter Otten wrote: def is_it_safe(source): return _ not in source and r'\' not in source .join(map(chr, [95, 95, 110, 111, 95, 95])) '__no__' But you don't have access to neither map or chr? /Joel

Re: Reading 3 objects at a time from list

2009-04-11 Thread Francesco Bochicchio
Chris Rebert ha scritto: On Sat, Apr 11, 2009 at 1:44 AM, Matteo tadweles...@gmail.com wrote: Hi all, let's see if there is a more pythonic way of doing what I'm trying to do. I have a lot of strings with numbers like this one: string = -1 1.3 100.136 1 2.6 100.726 1 3.9 101.464 -1 5.2 102.105

Re: How to create a virtual serial port?

2009-04-11 Thread Stuart Davenport
On 11 Apr, 08:52, Scott David Daniels scott.dani...@acm.org wrote: Stuart Davenport wrote: ... I'm on a OS X, python 2.5. Basically I will have a remote application pushing data (GPS) over the network to a python application I have running on my Mac, I want this python application to again

Re: An object that creates (nested) attributes automatically on assignment

2009-04-11 Thread Edd
Hi Steven, Thank you for your response! On Apr 11, 4:22 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Fri, 10 Apr 2009 19:04:38 -0700, Edd wrote: Hi folks, I'd like to use Python itself as the configuration language for my Python application. I'd like the user to be

Re: Reading 3 objects at a time from list

2009-04-11 Thread Peter Otten
Matteo wrote: Hi all, let's see if there is a more pythonic way of doing what I'm trying to do. I have a lot of strings with numbers like this one: string = -1 1.3 100.136 1 2.6 100.726 1 3.9 101.464 -1 5.2 102.105 I need to pass the numbers to a function, but three at a time, until

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Aaron Brady
On Apr 11, 3:18 am, Joel Hedlund yoh...@ifm.liu.se wrote: Aaron Brady wrote: Would you be willing to examine a syntax tree to determine if there are any class accesses? Sure? How do I do that? I've never done that type of thing before so I can't really say if it would work or not. /Joel

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Steven D'Aprano
On Sat, 11 Apr 2009 11:03:16 +0200, Joel Hedlund wrote: Peter Otten wrote: But what you're planning to do seems more like def is_it_safe(source): ... return _ not in source ... source = getattr(42, '\\x5f\\x5fclass\\x5f\\x5f') if is_it_safe(source): ... print eval(source) ...

Re: I can't get RLock to work (warning, the following code is pretty long)

2009-04-11 Thread Moriaantje
I think it would help if you would call your functions in get_both_parts with some arguments ... -- http://mail.python.org/mailman/listinfo/python-list

ANN: PyGUI 2.0

2009-04-11 Thread Greg Ewing
PyGUI 2.0 is available: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ Highlights of this release: * Native Windows implementation, based on pywin32 and ctypes. * Full set of Postscript-style path construction operators available on all platforms. * Mouse and keyboard events can

storing variable value

2009-04-11 Thread Daniel Dalton
Hi! I'm writing a program to provide me with battery warnings when my battery hits certain levels. It just checks the current level and does something. I plan to call it from a a cron job. But If the cron runs every minute, warnings every minute would be rather annoying. so is there a way to make

Re: Unsupported operand types in if/else list comprehension

2009-04-11 Thread Diez B. Roggisch
Mike H schrieb: Thanks to all of you. FYI, I'm doing this because I'm working on creating some insert statements in SQL, where string values need to be quoted, and integer values need to be unquoted. I wanted to be sure that I could pass these values to the list in a normal way e.g. ['test',

Re: An object that creates (nested) attributes automatically on assignment

2009-04-11 Thread Steven D'Aprano
On Sat, 11 Apr 2009 03:01:48 -0700, Edd wrote: Yes I probably mean instance attributes. Forgive me, I am not particularly sure of the terminology. But your MyClass example, won't quite do what I want, as I'd like to be able to define instance attributes on top of instance attributes by

Re: storing variable value

2009-04-11 Thread Diez B. Roggisch
Daniel Dalton schrieb: Hi! I'm writing a program to provide me with battery warnings when my battery hits certain levels. It just checks the current level and does something. I plan to call it from a a cron job. But If the cron runs every minute, warnings every minute would be rather annoying.

Re: storing variable value

2009-04-11 Thread Steven D'Aprano
On Sat, 11 Apr 2009 21:36:43 +1000, Daniel Dalton wrote: Hi! I'm writing a program to provide me with battery warnings when my battery hits certain levels. It just checks the current level and does something. I plan to call it from a a cron job. But If the cron runs every minute, warnings

Multithreading / multiprocess

2009-04-11 Thread tleeuwenb...@gmail.com
Is there anyway to begin a thread and execute a finite number of lines of code, or a finite amount of time within it? For example, say I create three child threads and I want to guarantee equal timeshare between them, can I specify a quanta (say 400 LOC although I know that is pretty small) to

Re: An object that creates (nested) attributes automatically on assignment

2009-04-11 Thread Edd
On Apr 11, 12:54 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Ah, now it is more clear. Okay, let's try this: class C(object): ...     def __getattr__(self, name): ...             # Only called if self.name doesn't exist. ...             inst = self.__class__() ...  

Re: Multithreading / multiprocess

2009-04-11 Thread Diez B. Roggisch
tleeuwenb...@gmail.com schrieb: Is there anyway to begin a thread and execute a finite number of lines of code, or a finite amount of time within it? For example, say I create three child threads and I want to guarantee equal timeshare between them, can I specify a quanta (say 400 LOC although

Using percent signs with SafeConfigParser

2009-04-11 Thread Márcio Faustino
Hi, Does the SafeConfigParser class correctly detects lone percent signs? For example, shouldn't the string 100%% be accepted as a valid value? Executing the code below should only print one error, instead it prints 2. (I've tested this with version 2.6.1 on Windows XP.) It seems the

Re: communication between objects - help

2009-04-11 Thread Dave Angel
Murali kumar wrote: thanks a lot.. I think passing the main object only by reference.. so, this does not causes any overhead.. am i correct..? On Fri, Apr 10, 2009 at 4:02 PM, Dave Angel da...@ieee.org wrote: Murali kumar wrote: hi all.. I'm posted in a word doc becoz to add a

multiprocessing and Locks

2009-04-11 Thread gvv
Hi All, I am trying to understand multiprocessing, but I am getting a Runtime error on the code below. What am I missing or doing wrong? Error is: RuntimeError: Lock objects should only be shared between processes through inheritance I am using: Python 2.6 (r26:66714, Nov 28 2008, 22:17:21) [GCC

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Paul McGuire
On Apr 11, 2:41 am, Aaron Brady castiro...@gmail.com wrote: Why do I get the feeling that the authors of 'pyparsing' are out of breath? What kind of breathlessness do you mean? I'm still breathing, last time I checked. The-rumors-of-my-demise-have-been-greatly-exaggerated'ly yours, -- Paul

[ANN] Falcon - powering innovation

2009-04-11 Thread Kless
If anybody is interesed in new technologies, you'll love this new language called Falcon [1], which has been open sourced ago little time. Falcon is a scripting engine ready to empower mission-critical multithreaded applications. It provides six integrated programming paradigms: procedural,

Re: storing variable value

2009-04-11 Thread Dave Angel
Daniel Dalton wrote: Hi! I'm writing a program to provide me with battery warnings when my battery hits certain levels. It just checks the current level and does something. I plan to call it from a a cron job. But If the cron runs every minute, warnings every minute would be rather annoying.

Re: How to create a virtual serial port?

2009-04-11 Thread Grant Edwards
On 2009-04-10, Stuart Davenport stuart.davenp...@gmail.com wrote: I'm on a OS X, python 2.5. Basically I will have a remote application pushing data (GPS) over the network to a python application I have running on my Mac, I want this python application to again push the data on to a virtual

Merging byte arrays

2009-04-11 Thread Gabriel
Hello I'm using this function to read data in byte format from file def readBytes(file, offset, size): file.seek(offset) return file.read(size) file is opened with open function: file = open(path, rb) then i'm using array.array('B', bytes) to parse read-out data, for example in this

Definition of Pythonic?

2009-04-11 Thread Emmanuel Surleau
Hi there, I'm starting an exploratory foray into Python, being generally dissatisfied with the Ruby ecosystem (while the language is wonderful, third party libraries and documentation are not). Having written a few trivial scripts in Python, I'm curious as to how you would sum up the Pythonic

Re: Why is it that *dbm modules don't provide an iterator? (Language design question)

2009-04-11 Thread Akira Kitada
Opened a ticket for this and attached a patch. (experimental) http://bugs.python.org/issue5736 On Fri, Apr 10, 2009 at 8:39 AM, Martin v. Löwis mar...@v.loewis.de wrote: I assumed there were some decisions behind this, rather than it's just not implemented yet. I believe this assumption is

completly unrelated to python but i had to post it

2009-04-11 Thread janus99
i know, i know , this group is about python, but this artilce i just read, well i was pretty much just surfing the web when i found this article made in 2001, it is just 2 funny. http://www.adequacy.org/stories/2001.12.2.42056.2147.html\ if u've never read it, it'll knock ur socks off, and the

Re: numpy.where

2009-04-11 Thread Lou Pecora
In article 747te7f1209a...@mid.individual.net, Peter Pearson ppear...@nowhere.invalid wrote: On Thu, 09 Apr 2009 09:09:18 -0400, Lou Pecora wrote: Really, I've gotta RTFM. :-) Hey, if you find TFM, please tell me where it is. I haven't found anything Fine. I even bought Travis

llvm vs. parrot

2009-04-11 Thread Paul Watson
Is Parrot out of favor these days? It appears that Google is going to use llvm. http://code.google.com/p/unladen-swallow/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Definition of Pythonic?

2009-04-11 Thread Tim Chase
Having written a few trivial scripts in Python, I'm curious as to how you would sum up the Pythonic philosophy of development. Judging from Python, it seems to exclude (mostly) magical variables like '$.'. Is this right? What else would you include in this definition? At the python

Re: Definition of Pythonic?

2009-04-11 Thread skip
Emm Having written a few trivial scripts in Python, I'm curious as to Emm how you would sum up the Pythonic philosophy of development. Try import this at your friendly, neighborhood Python prompt. -- Skip Montanaro - s...@pobox.com - http://www.smontanaro.net/ XML sucks,

Re: llvm vs. parrot

2009-04-11 Thread Carlos Ribeiro
On Fri, Apr 10, 2009 at 20:16, Paul Watson paul.hermeneu...@gmail.comwrote: Is Parrot out of favor these days? It appears that Google is going to use llvm. As far as I can recall, Parrot was supposed to be an April Fools Day joke (literally) that was taken way too seriously. Parrot may had

Re: Merging byte arrays

2009-04-11 Thread MRAB
Gabriel wrote: Hello I'm using this function to read data in byte format from file def readBytes(file, offset, size): file.seek(offset) return file.read(size) file is opened with open function: file = open(path, rb) then i'm using array.array('B', bytes) to parse read-out data, for

Startup with Python

2009-04-11 Thread Strato
Hello, I am a beginner in Python , i am not able to set the environment variable in windows so that i can execute python script through command prompt , and also i am not able to male *.py as executable i.e. whenever i double click the file it should run it. Please help and reply me at

Re: Pathological regular expression

2009-04-11 Thread Steven D'Aprano
On Thu, 09 Apr 2009 02:56:00 -0700, David Liang wrote: Hi all, I'm having a weird problem with a regular expression (tested in 2.6 and 3.0): Basically, any of these: _re_comments = re.compile(r'^(([^\\]+|\\.|([^\\]+|\\.)*)*)#.*$') _re_comments =

Re: How to create a virtual serial port?

2009-04-11 Thread Scott David Daniels
Stuart Davenport wrote: On 11 Apr, 08:52, Scott David Daniels scott.dani...@acm.org wrote: Stuart Davenport wrote: ... I'm on a OS X, python 2.5 Then the GPS program I have running on my MAC, RouteBuddy, can read the data from that serial port as standard. I'ms confused by this statement.

Writing a Raw Image to a File (Win, PIL)

2009-04-11 Thread W. eWatson
I have an image of described as: Img Info: {} size: (640, 480) format: None mode: P palette: ImagePalette.ImagePalette instance at 0x02393378 bands: ('P',) type: type 'instance' I'd like to write it to a file. Apparently, I need to convert it to a string first. How do I do that?

Re: Unsupported operand types in if/else list comprehension

2009-04-11 Thread Mike H
Ok, thanks again to everyone for their suggestions, even if it appears I was going down the wrong path at the start. I'm a grad student creating this database to hold some of my own research on an isolated server, so security, etc. isn't my biggest concern -- but I would like to do this right.

Re: Pathological regular expression

2009-04-11 Thread MRAB
Steven D'Aprano wrote: On Thu, 09 Apr 2009 02:56:00 -0700, David Liang wrote: Hi all, I'm having a weird problem with a regular expression (tested in 2.6 and 3.0): Basically, any of these: _re_comments = re.compile(r'^(([^\\]+|\\.|([^\\]+|\\.)*)*)#.*$') _re_comments =

Re: Pathological regular expression

2009-04-11 Thread John Machin
On Apr 12, 1:07 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Thu, 09 Apr 2009 02:56:00 -0700, David Liang wrote: Hi all, I'm having a weird problem with a regular expression (tested in 2.6 and 3.0): Basically, any of these: _re_comments =

Re: Writing a Raw Image to a File (Win, PIL)

2009-04-11 Thread Diez B. Roggisch
W. eWatson schrieb: I have an image of described as: Img Info: {} size: (640, 480) format: None mode: P palette: ImagePalette.ImagePalette instance at 0x02393378 bands: ('P',) type: type 'instance' I'd like to write it to a file. Apparently, I need to convert it to a string first.

Re: Pathological regular expression

2009-04-11 Thread Dotan Cohen
IMHO it's not a bug -- s/hang/takes a long time to compute/ ‎That is quite what a hang is, and why the timeout was invented. The real bug is that there is no timeout mechanism. Just look at it: 2 + operators and 3 * operators ... It's one of those come back after lunch REs. Some users

Re: Definition of Pythonic?

2009-04-11 Thread Aahz
In article mailman.3700.1239458914.11746.python-l...@python.org, Emmanuel Surleau emmanuel.surl...@gmail.com wrote: Having written a few trivial scripts in Python, I'm curious as to how you would sum up the Pythonic philosophy of development. Judging from Python, it seems to exclude (mostly)

Re: Unsupported operand types in if/else list comprehension

2009-04-11 Thread Mike H
Well, I'm an idiot. Obviously, the line VALUES (%s, %s, %s); needs to be modified to adapt for the number of arguments in the list. But otherwise On Sat, Apr 11, 2009 at 11:28 AM, Mike H cmh.pyt...@gmail.com wrote: Ok, thanks again to everyone for their suggestions, even if it appears I was

Re: Definition of Pythonic?

2009-04-11 Thread John Yeung
On Apr 11, 10:08 am, Emmanuel Surleau emmanuel.surl...@gmail.com wrote: Having written a few trivial scripts in Python, I'm curious as to how you would sum up the Pythonic philosophy of development. A couple of others have already mentioned the Zen of Python, available at the Python command

Re: Startup with Python

2009-04-11 Thread Esmail
Strato wrote: Hello, I am a beginner in Python , i am not able to set the environment variable in windows so that i can execute python script through command prompt , and also i am not able to male *.py as executable i.e. whenever i double click the file it should run it. Please help and reply

Re: Startup with Python

2009-04-11 Thread Emile van Sebille
Strato wrote: Hello, I am a beginner in Python , i am not able to set the environment variable in windows so that i can execute python script through command prompt , and also i am not able to male *.py as executable i.e. whenever i double click the file it should run it. Download and install

Re: Definition of Pythonic?

2009-04-11 Thread MRAB
John Yeung wrote: On Apr 11, 10:08 am, Emmanuel Surleau emmanuel.surl...@gmail.com wrote: Having written a few trivial scripts in Python, I'm curious as to how you would sum up the Pythonic philosophy of development. A couple of others have already mentioned the Zen of Python, available at

Re: Writing a Raw Image to a File (Win, PIL)

2009-04-11 Thread W. eWatson
Diez B. Roggisch wrote: W. eWatson schrieb: I have an image of described as: Img Info: {} size: (640, 480) format: None mode: P palette: ImagePalette.ImagePalette instance at 0x02393378 bands: ('P',) type: type 'instance' I'd like to write it to a file. Apparently, I need to

Re: Pathological regular expression

2009-04-11 Thread MRAB
Dotan Cohen wrote: IMHO it's not a bug -- s/hang/takes a long time to compute/ ‎That is quite what a hang is, and why the timeout was invented. The real bug is that there is no timeout mechanism. I wouldn't call it a hang because it is actually doing work. If it was 'stuck' on a certain

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Aaron Brady
On Apr 11, 8:09 am, Paul McGuire pt...@austin.rr.com wrote: On Apr 11, 2:41 am, Aaron Brady castiro...@gmail.com wrote: Why do I get the feeling that the authors of 'pyparsing' are out of breath? What kind of breathlessness do you mean?  I'm still breathing, last time I checked.

Re: Can't create list of dictionaries

2009-04-11 Thread Gabriel Genellina
On Apr 10, 12:36 pm, sophie_newbie paulgeele...@gmail.com wrote: I've got a function that returns a dictionary, I need to loop and return 1000 dictionaries and append them to a list, but the thing is that when I do the list.append(funtThatReturnsDict()) the resulting only ever has 1 dictionary

Re: ANN: PyGUI 2.0

2009-04-11 Thread member thudfoo
Line 25 of setup.py should be: packages.append(GUI.Gtk) -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing a Raw Image to a File (Win, PIL)

2009-04-11 Thread MRAB
W. eWatson wrote: I have an image of described as: Img Info: {} size: (640, 480) format: None mode: P palette: ImagePalette.ImagePalette instance at 0x02393378 bands: ('P',) type: type 'instance' I'd like to write it to a file. Apparently, I need to convert it to a string first.

Re: Async serial communication/threads sharing data

2009-04-11 Thread Jean-Paul Calderone
On Wed, 25 Mar 2009 22:23:25 -0700, John Nagle na...@animats.com wrote: Jean-Paul Calderone wrote: On Tue, 24 Mar 2009 22:20:49 -0700, John Nagle na...@animats.com wrote: Jean-Paul Calderone wrote: On Mon, 23 Mar 2009 05:30:04 -0500, Nick Craig-Wood n...@craig-wood.com wrote: Jean-Paul

Re: Pathological regular expression

2009-04-11 Thread Aaron Brady
On Apr 11, 10:07 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Thu, 09 Apr 2009 02:56:00 -0700, David Liang wrote: Hi all, I'm having a weird problem with a regular expression (tested in 2.6 and 3.0): Basically, any of these: _re_comments =

Re: Writing a Raw Image to a File (Win, PIL)

2009-04-11 Thread W. eWatson
MRAB wrote: W. eWatson wrote: I have an image of described as: Img Info: {} size: (640, 480) format: None mode: P palette: ImagePalette.ImagePalette instance at 0x02393378 bands: ('P',) type: type 'instance' I'd like to write it to a file. Apparently, I need to convert it to a

Re: Multithreading / multiprocess

2009-04-11 Thread Aahz
In article 57065c62-2024-47b5-a07e-1d60ff85b...@y10g2000prc.googlegroups.com, tleeuwenb...@gmail.com tleeuwenb...@gmail.com wrote: Is there anyway to begin a thread and execute a finite number of lines of code, or a finite amount of time within it? For example, say I create three child threads

Re: How to create a virtual serial port?

2009-04-11 Thread Grant Edwards
On 2009-04-11, Scott David Daniels scott.dani...@acm.org wrote: ... I'm on a OS X, python 2.5 Then the GPS program I have running on my MAC, RouteBuddy, can read the data from that serial port as standard. I'ms confused by this statement. What physical connector does your serial port

Re: sharing/swapping items between lists

2009-04-11 Thread Aahz
In article 4fd78ac3-ba83-456b-b768-3a0043548...@f19g2000vbf.googlegroups.com, Ross ross.j...@gmail.com wrote: I'm trying to design an iterator that produces two lists. The first list will be a list of unique pairings and the second will be a list of items that weren't used in the first list.

Re: Pathological regular expression

2009-04-11 Thread Steven D'Aprano
On Sat, 11 Apr 2009 08:40:03 -0700, John Machin wrote: To my mind, this is a bug in the RE engine. Is there any reason to not treat it as a bug? IMHO it's not a bug -- s/hang/takes a long time to compute/ Just look at it: 2 + operators and 3 * operators ... It's one of those come back

Re: Reading 3 objects at a time from list

2009-04-11 Thread Aahz
In article 49e06774$0$700$5fc3...@news.tiscali.it, Francesco Bochicchio bock...@virgilio.it wrote: On Sat, Apr 11, 2009 at 1:44 AM, Matteo tadweles...@gmail.com wrote: I need to pass the numbers to a function, but three at a time, until the string ends. The strings are of variable length, but

Re: Pathological regular expression

2009-04-11 Thread Dotan Cohen
Well, it's been running now for about two and a half hours, that's a rather long lunch. I'd also like a pony! -- Dotan Cohen http://what-is-what.com http://gibberish.co.il -- http://mail.python.org/mailman/listinfo/python-list

Re: How to create a virtual serial port?

2009-04-11 Thread Grant Edwards
On 2009-04-11, Grant Edwards gra...@visi.com wrote: You can write a port redirector in user-space in MS-Windows, but you can't in Linux/Unix. On Unix systems you have to write a kernel module that sits below the tty layer. Perhaps I should elucidate further. That's what the pty driver on

Re: Definition of Pythonic?

2009-04-11 Thread Emmanuel Surleau
On Saturday 11 April 2009 18:00:58 John Yeung wrote: On Apr 11, 10:08 am, Emmanuel Surleau emmanuel.surl...@gmail.com wrote: Having written a few trivial scripts in Python, I'm curious as to how you would sum up the Pythonic philosophy of development. A couple of others have already

design question, metaclasses?

2009-04-11 Thread Darren Dale
I am working on a project that provides a high level interface to hdf5 files by implementing a thin wrapper around h5py. I would like to generalize the project so the same API can be used with other formats, like netcdf or ascii files. The format specific code exists in File, Group and Dataset

Re: Pathological regular expression

2009-04-11 Thread Aaron Brady
On Apr 11, 12:40 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Sat, 11 Apr 2009 08:40:03 -0700, John Machin wrote: To my mind, this is a bug in the RE engine. Is there any reason to not treat it as a bug? IMHO it's not a bug -- s/hang/takes a long time to compute/

Re: How to create a virtual serial port?

2009-04-11 Thread Scott David Daniels
Grant Edwards wrote: On 2009-04-11, Grant Edwards gra...@visi.com wrote: You can write a port redirector in user-space in MS-Windows, but you can't in Linux/Unix. On Unix systems you have to write a kernel module that sits below the tty layer. Perhaps I should elucidate further. This part

Regex similar to ^(?u)\w$, but without digits?

2009-04-11 Thread Andreas
Hello, I'd like to create a regex that captures any unicode character, but not the underscore and the digits 0-9. ^(?u)\w$ captures them also. Is there a possibility to restrict an expression like \w to \w without [0-9_]? I'm using python 2.5.4 Thanks in advance, Andreas --

Re: Unsupported operand types in if/else list comprehension

2009-04-11 Thread Mike H
Sigh. One more. And again, thank you for all of the help. I realized that the last version that I posted took care of an SQL injection problem for the values, but not for the fields. So, I went ahead and modified the code: def new_insert_cmd(myTable, myFields, myValues): Imports given fields

Re: Definition of Pythonic?

2009-04-11 Thread Mark Wooding
John Yeung gallium.arsen...@gmail.com writes: A couple of others have already mentioned the Zen of Python, available at the Python command prompt. I would agree with that, but also add the caveat that none of the principles expressed there are hard-and- fast rules. Indeed, I'd suggest that

Re: How to create a virtual serial port?

2009-04-11 Thread Ned Deily
In article 6lgdnsbypsl1fx3unz2dnuvz_uqdn...@pdx.net, Scott David Daniels scott.dani...@acm.org wrote: This part I actually understand. The OP has a program named RouteBuddy that talks to a device over a serial port, and he want to repalce the data stream coming from that device. My question

Re: Using percent signs with SafeConfigParser

2009-04-11 Thread Peter Otten
Márcio Faustino wrote: Does the SafeConfigParser class correctly detects lone percent signs? For example, shouldn't the string 100%% be accepted as a valid value? Executing the code below should only print one error, instead it prints 2. (I've tested this with version 2.6.1 on Windows XP.)

Re: Reading 3 objects at a time from list

2009-04-11 Thread Vito De Tullio
Matteo wrote: it works and I like slices, but I was wondering if there was another way of doing the same thing, maybe reading the numbers in groups of arbitrary length n... from http://docs.python.org/library/itertools.html#recipes def grouper(n, iterable, fillvalue=None): grouper(3,

Re: How to create a virtual serial port?

2009-04-11 Thread Grant Edwards
On 2009-04-11, Scott David Daniels scott.dani...@acm.org wrote: Grant Edwards wrote: On 2009-04-11, Grant Edwards gra...@visi.com wrote: You can write a port redirector in user-space in MS-Windows, but you can't in Linux/Unix. On Unix systems you have to write a kernel module that sits

Re: How to create a virtual serial port?

2009-04-11 Thread Grant Edwards
On 2009-04-11, Ned Deily n...@acm.org wrote: In article 6lgdnsbypsl1fx3unz2dnuvz_uqdn...@pdx.net, Scott David Daniels scott.dani...@acm.org wrote: This part I actually understand. The OP has a program named RouteBuddy that talks to a device over a serial port, and he want to repalce the

Re: How to create a virtual serial port?

2009-04-11 Thread alex goretoy
A number of vendors (Keyspan, Belkin) make USB serial ports. FWIW, I use one here on this iMac and OS X with screen(1) and a null modem cable to act as a serial console for a headless Linux box. +1 -Alex Goretoy http://www.goretoy.com Norman

Q:Pythonic way to create list of lists

2009-04-11 Thread grkuntzmd
I am just learning Python. I am trying to create a list of empty lists: [[], [], [], ...] (10 items total). What is the most Pythonic way to do this? If I use a list comprehension (as in myList = [[] for item in xrange (0, 10)]), Netbeans warns me that 'item' is never used. If I use a for-loop

absolute newbie: divide a list into sublists (nested lists?) of fixed length

2009-04-11 Thread ergconcepts
Hi, I have a list looking like [ 0.84971586, 0.05786009, 0.9645675, 0.84971586, 0.05786009, 0.9645675, 0.84971586, 0.05786009, 0.9645675, 0.84971586, 0.05786009, 0.9645675] and I would like to break this list into subsets of fixed length (say, three elements), i.e. to convert the list

  1   2   3   >