Re: Python student seeks help regex/strings

2009-04-11 Thread John Machin
On Apr 12, 2:30 pm, Petyr David wrote: > I'm familiar with simple string substitutions in shell and perl: > > string= "I have 30 days to find it" > > echo $string | sed "s/\(.*\)\(30\)\(.*\)/\2/ > > which will (if I did it right) leave 30 > > and perl likewise. > > I'm having trouble figuring out

Re: Python student seeks help regex/strings

2009-04-11 Thread n00m
>>> s = 'I have 30 days to find it' >>> ss = filter(lambda si: si.isdigit(), s) >>> ss '30' >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: communication between objects - help

2009-04-11 Thread Murali kumar
Thanks a lot for help.. On Sat, Apr 11, 2009 at 6:27 PM, Dave Angel wrote: > > > 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 An

Re: Regular Expression Help

2009-04-11 Thread John Machin
On Apr 12, 2:19 pm, ru...@yahoo.com wrote: > On Apr 11, 9:42 pm, Jean-Claude Neveu > wrote: > > > My regexp that I'm matching against is: "^\$\£?\d{0,10}(\.\d{2})?$" > > > Here's how I think it should work (but clearly > > I'm wrong, because it does not actually work): > > > ^\$\£?      Require ze

Re: any(), all() and empty iterable

2009-04-11 Thread Luis Alberto Zarrabeitia Gomez
Quoting John O'Hagan : > Hi, > > I was getting some surprising false positives as a result of not expecting > this: > > all(element in item for item in iterable) > > to return True when 'iterable' is empty. > [...] > any(element in item for item in iterable) > > which returns False when 'i

Re: any(), all() and empty iterable

2009-04-11 Thread Albert Hopkins
On Sun, 2009-04-12 at 04:00 +, John O'Hagan wrote: > Hi, > > I was getting some surprising false positives as a result of not expecting > this: > > all(element in item for item in iterable) > > to return True when 'iterable' is empty. > > I guess it goes into hairy Boolean territory tryin

Python student seeks help regex/strings

2009-04-11 Thread Petyr David
I'm familiar with simple string substitutions in shell and perl: string= "I have 30 days to find it" echo $string | sed "s/\(.*\)\(30\)\(.*\)/\2/ which will (if I did it right) leave 30 and perl likewise. I'm having trouble figuring out how to do this in Python and it's not for lack of trying

Re: any(), all() and empty iterable

2009-04-11 Thread Chris Rebert
On Sat, Apr 11, 2009 at 9:00 PM, John O'Hagan wrote: > Hi, > > I was getting some surprising false positives as a result of not expecting > this: > > all(element in item for item in iterable) > > to return True when 'iterable' is empty. > > I guess it goes into hairy Boolean territory trying to de

Re: Regular Expression Help

2009-04-11 Thread rurpy
On Apr 11, 9:42 pm, Jean-Claude Neveu wrote: > My regexp that I'm matching against is: "^\$\£?\d{0,10}(\.\d{2})?$" > > Here's how I think it should work (but clearly > I'm wrong, because it does not actually work): > > ^\$\£? Require zero or one instance of $ or £ at the start of the string.

Python and XML Help

2009-04-11 Thread ookrin
I'm in the process of learning python and PyQt4. I had decided to make myself a simple app and soon discovered that I needed to crash into xml to use some of the data I was going to be getting off of the server. I picked up enough xml to use the sax parser to get the data out of the xml. I can get

any(), all() and empty iterable

2009-04-11 Thread John O'Hagan
Hi, I was getting some surprising false positives as a result of not expecting this: all(element in item for item in iterable) to return True when 'iterable' is empty. I guess it goes into hairy Boolean territory trying to decide if an element is in an item that doesn't exist (if that's what

Regular Expression Help

2009-04-11 Thread Jean-Claude Neveu
Hello, I was wondering if someone could tell me where I'm going wrong with my regular expression. I'm trying to write a regexp that identifies whether a string contains a correctly-formatted currency amount. I want to support dollars, UK pounds and Euros, but the example below deliberately o

Re: How to create a virtual serial port?

2009-04-11 Thread JanC
Grant Edwards wrote: > On 2009-04-10, Stuart Davenport wrote: > >> I am trying to work out if its possible, to create a virtual serial >> port with Python? > > On Linux: no. I wonder if there is no way to emulate ptys from userspace? (Like you can use FUSE to implement filesystems in python.)

Re: llvm vs. parrot

2009-04-11 Thread Lawrence D'Oliveiro
In message <1239405385.6357.1.ca...@linux-3eb6.site>, Paul Watson wrote: > Is Parrot out of favor these days? Nonsense. It's just resting. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.6/3.0 packages for Ubuntu?

2009-04-11 Thread JanC
Francesco Bochicchio wrote: > 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? > In cu

Re: How to create a virtual serial port?

2009-04-11 Thread Grant Edwards
On 2009-04-11, Dennis Lee Bieber 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. The tty layer >> is what user applications talk to with open/close/read/wri

Re: How to create a virtual serial port?

2009-04-11 Thread Grant Edwards
On 2009-04-11, Scott David Daniels wrote: > Grant Edwards wrote: >> ...If he was going to plug the device into a real serial port on >> the machine inquestion, then he wouldn't need a virtual serial >> port. >> >>> I don't see anywhere on my laptop I could plug in anything but >>> a USB connector

Re: Re: Generators/iterators, Pythonicity, and primes

2009-04-11 Thread John Posner
Arnaud Delobelle wrote: You could do something like this with the help of itertools.ifilter: prime_gen = ifilter( lambda n, P=[]: all(n%p for p in P) and not P.append(n), count(2) ) Formidable! (both the English and French meanings) This is the most elegant, Sieve of Eratos

Re: Pathological regular expression

2009-04-11 Thread John Machin
On Apr 12, 10:31 am, Steven D'Aprano wrote: > On Sat, 11 Apr 2009 16:46:20 -0700, John Machin wrote: > > On Apr 12, 3:40 am, Steven D'Aprano > 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 re

Re: Pathological regular expression

2009-04-11 Thread Aaron Brady
On Apr 11, 7:31 pm, Steven D'Aprano wrote: _ > My original test has now been running for close to ten hours now, and > still can't be interrupted with ctrl-C. However that's in Python 2.5, > having tried it in Python 2.6.2 they can be interrupted, so I'm satisfied > that this bug of "regex hangs t

Re: PyHeapTypeObject

2009-04-11 Thread Aaron Brady
On Apr 11, 7:36 pm, Brendan Miller wrote: > What's the point of PyHeapTypeObject in Include/object.h? Why does the > layout of object types need to be different on the heap vs statically > allocated? > > Thanks, > Brendan Does it need to be garbage collected, finalized, and deallocated? E.g. the

PyHeapTypeObject

2009-04-11 Thread Brendan Miller
What's the point of PyHeapTypeObject in Include/object.h? Why does the layout of object types need to be different on the heap vs statically allocated? Thanks, Brendan -- http://mail.python.org/mailman/listinfo/python-list

Re: Pathological regular expression

2009-04-11 Thread Steven D'Aprano
On Sat, 11 Apr 2009 16:46:20 -0700, John Machin wrote: > On Apr 12, 3:40 am, Steven D'Aprano 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

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

2009-04-11 Thread Mark Tolonen
"Andreas" wrote in message news:f953c845-3660-4bb5-8ba7-00b93989c...@b1g2000vbc.googlegroups.com... > 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 exp

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

2009-04-11 Thread John Machin
On Apr 12, 4:29 am, Andreas wrote: > Hello, > > I'd like to create a regex that captures any unicode character, but > not the underscore and the digits 0-9. [requirement 1] > "^(?u)\w$" captures them also. > Is there a possibility to restrict an expression like "\w" to "\w > without [0-9_]"? [r

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

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

Re: Pathological regular expression

2009-04-11 Thread John Machin
On Apr 12, 9:46 am, John Machin wrote: >             result = _re_comments_nc.sub(r"\1", line) s/_nc// ... that's an artifact of timing it with Non-Capture groups (?:blahblah) on the two internal groups that don't need to be capturing (results identical, and no perceptible effect on running time

Re: Pathological regular expression

2009-04-11 Thread John Machin
On Apr 12, 3:40 am, Steven D'Aprano 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/ > > > Just look at it: 2 + opera

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

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

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

2009-04-11 Thread Diez B. Roggisch
W. eWatson schrieb: Diez B. Roggisch wrote: W. eWatson schrieb: I have an image of described as: Img Info: {} size: (640, 480) format: None mode: P palette: bands: ('P',) type: 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: Multiprocessing module

2009-04-11 Thread Gabriel Genellina
En Fri, 10 Apr 2009 06:46:47 -0300, Deepak Rokade escribió: Since this application is going to be commercial one I want to know at this stage if there are any known serious bugs (not limitations) in the multiprocessing module? Go to http://bugs.python.org/ click on Search on the left, and

Re: Using percent signs with SafeConfigParser

2009-04-11 Thread MRAB
Márcio Faustino wrote: > On 11 Abr, 20:06, Peter Otten <__pete...@web.de> wrote: >> I think you are right. Please file a bug report . > > I will. > >> IMO this doesn't fix the problem because >> >> (1) it allows "%%%" which is also incorrect > > You're right, how about this one "(? Instead of chec

Re: Using percent signs with SafeConfigParser

2009-04-11 Thread Márcio Faustino
On 11 Abr, 20:06, Peter Otten <__pete...@web.de> wrote: > I think you are right. Please file a bug report . I will. > IMO this doesn't fix the problem because > > (1) it allows "%%%" which is also incorrect You're right, how about this one "(? (2) _interpvar_re has already butchered values like

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

2009-04-11 Thread George Sakkis
On Apr 11, 6:05 pm, ergconce...@googlemail.com wrote: > On Apr 11, 11:18 pm, George Sakkis wrote: > > > > > The numpy import *is* important if you want to use numpy-specific > > features; there are many "tricks" you can do easily with numpy arrays > > that you have to write manually for, say, regu

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

2009-04-11 Thread Andre Engels
On Sun, Apr 12, 2009 at 12:05 AM, wrote: > Thanks very much - works fine! Now for a follow-up question:) > > Actually my original list called "mylist" contains 81217 elements - I > shape those into > len(mylist) > 81217 s = N.array(mylist) s.shape = (241,337) > > which works becau

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

2009-04-11 Thread ergconcepts
On Apr 11, 11:18 pm, George Sakkis wrote: > The numpy import *is* important if you want to use numpy-specific > features; there are many "tricks" you can do easily with numpy arrays > that you have to write manually for, say, regular python lists. For > example what you want to do is trivial with

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

2009-04-11 Thread Mensanator
On Apr 11, 4:18�pm, George Sakkis wrote: > On Apr 11, 4:14�pm, ergconce...@googlemail.com wrote: > > > > > > > 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,

Re: Overriding __init__() questions

2009-04-11 Thread Terry Reedy
grocery_stocker wrote: What's the difference between doing something calling A.__init__(self) like in the following... [cdal...@localhost ~]$ python Python 2.4.3 (#1, Oct 1 2006, 18:00:19) [GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2 Type "help", "copyright", "credits" or "license" for mor

Re: Q:Pythonic way to create list of lists

2009-04-11 Thread Terry Reedy
grkunt...@gmail.com wrote: 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 neve

Re: Pathological regular expression

2009-04-11 Thread MRAB
Steven D'Aprano 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/ Just look at it: 2 + operators and 3 * operators ... It's one of

Re: Generators/iterators, Pythonicity, and primes

2009-04-11 Thread Arnaud Delobelle
John Posner writes: > Inspired by recent threads (and recalling my first message to Python > edu-sig), I did some Internet searching on producing prime numbers using > Python generators. Most algorithms I found don't go for the infinite, > contenting themselves with "list all the primes below a g

Re: ANN: PyGUI 2.0

2009-04-11 Thread Terry Reedy
Greg Ewing wrote: PyGUI 2.0 is available: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ Does it work with 3.0? (or just 2.3-2.6?) -- http://mail.python.org/mailman/listinfo/python-list

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

2009-04-11 Thread George Sakkis
On Apr 11, 4:14 pm, ergconce...@googlemail.com wrote: > 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

Overriding __init__() questions

2009-04-11 Thread grocery_stocker
What's the difference between doing something calling A.__init__(self) like in the following... [cdal...@localhost ~]$ python Python 2.4.3 (#1, Oct 1 2006, 18:00:19) [GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> class

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

2009-04-11 Thread ergconcepts
On Apr 11, 10:37 pm, Andreas Pfrengle wrote: > my_list = [] > for x in range(3): >  my_list.append([]) >  for y in range(3): >   my_list[x].append(some_value) Thanks for your help - but I'm sorry I do not understand: > my_list = [] I guess here you are implying to write something like my_list

Re: Unsupported operand types in if/else list comprehension

2009-04-11 Thread George Sakkis
On Apr 11, 4:26 pm, Mike H wrote: > George, > > I'd love to. Can you give me an idea of where to start looking? I've > gone through a couple of books, and Googled a ton of websites. Maybe > I'm just not using the right terms. My background is definitely not > CompSci. But if you'd give me a sugge

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

2009-04-11 Thread Andreas Pfrengle
On 11 Apr., 22:14, ergconce...@googlemail.com wrote: > 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

Re: How to create a virtual serial port?

2009-04-11 Thread Scott David Daniels
Grant Edwards wrote: ...If he was going to plug the device into a real serial port on the machine inquestion, then he wouldn't need a virtual serial port. I don't see anywhere on my laptop I could plug in anything but a USB connector, an ethernet connector, a firewire connector, headphones, spe

Re: How to create a virtual serial port?

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

Re: Unsupported operand types in if/else list comprehension

2009-04-11 Thread Mike H
George, I'd love to. Can you give me an idea of where to start looking? I've gone through a couple of books, and Googled a ton of websites. Maybe I'm just not using the right terms. My background is definitely not CompSci. But if you'd give me a suggestion of where to look, I'd appreciate it. Tha

Re: Q:Pythonic way to create list of lists

2009-04-11 Thread Tim Chase
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. Not using Netbeans, I can't verify that the be

Re: Unsupported operand types in if/else list comprehension

2009-04-11 Thread George Sakkis
On Apr 11, 3:03 pm, Mike H wrote: > Can I not use the cursor.execute command to pass variables that aren't > immediately next to each other? If so, is there a better way to go > about solving this problem? Yes, there is. Use one of the several production quality python SQL toolkits built for exa

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 int

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

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 Mailer

Re: How to create a virtual serial port?

2009-04-11 Thread Grant Edwards
On 2009-04-11, Ned Deily wrote: > In article <6lgdnsbypsl1fx3unz2dnuvz_uqdn...@pdx.net>, > Scott David Daniels 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 t

Re: How to create a virtual serial port?

2009-04-11 Thread Grant Edwards
On 2009-04-11, Scott David Daniels wrote: > Grant Edwards wrote: >> On 2009-04-11, Grant Edwards 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. >> >

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: 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: How to create a virtual serial port?

2009-04-11 Thread Ned Deily
In article <6lgdnsbypsl1fx3unz2dnuvz_uqdn...@pdx.net>, Scott David Daniels 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 is, "where do

Re: Definition of Pythonic?

2009-04-11 Thread Mark Wooding
John Yeung 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 the very lack of hard-a

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 fiel

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

Re: How to create a virtual serial port?

2009-04-11 Thread Scott David Daniels
Grant Edwards wrote: On 2009-04-11, Grant Edwards 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 I actually unde

Re: Pathological regular expression

2009-04-11 Thread Aaron Brady
On Apr 11, 12:40 pm, Steven D'Aprano 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/ > > > Just look at it: 2 + oper

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 clas

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

Re: How to create a virtual serial port?

2009-04-11 Thread Grant Edwards
On 2009-04-11, Grant Edwards 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 Unix is: a ke

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: Reading 3 objects at a time from list

2009-04-11 Thread Aahz
In article <49e06774$0$700$5fc3...@news.tiscali.it>, Francesco Bochicchio wrote: >> On Sat, Apr 11, 2009 at 1:44 AM, Matteo 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 always a >>> multiple of th

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 > "com

Re: sharing/swapping items between lists

2009-04-11 Thread Aahz
In article <4fd78ac3-ba83-456b-b768-3a0043548...@f19g2000vbf.googlegroups.com>, Ross 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. After each round,

Re: How to create a virtual serial port?

2009-04-11 Thread Grant Edwards
On 2009-04-11, Scott David Daniels 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" use to

Re: Multithreading / multiprocess

2009-04-11 Thread Aahz
In article <57065c62-2024-47b5-a07e-1d60ff85b...@y10g2000prc.googlegroups.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 and I want to gua

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: bands: ('P',) type: I'd like to write it to a file. Apparently, I need to convert it to a string first. How do I do that? Pickle? Have you tried the .tost

Re: Pathological regular expression

2009-04-11 Thread Aaron Brady
On Apr 11, 10:07 am, 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: Async serial communication/threads sharing data

2009-04-11 Thread Jean-Paul Calderone
On Wed, 25 Mar 2009 22:23:25 -0700, John Nagle wrote: Jean-Paul Calderone wrote: On Tue, 24 Mar 2009 22:20:49 -0700, John Nagle wrote: Jean-Paul Calderone wrote: On Mon, 23 Mar 2009 05:30:04 -0500, Nick Craig-Wood wrote: Jean-Paul Calderone wrote: [snip] After bringing in all the heav

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: bands: ('P',) type: I'd like to write it to a file. Apparently, I need to convert it to a string first. How do I do that? Pickle? Have you tried the .tostring() method

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: Can't create list of dictionaries

2009-04-11 Thread Gabriel Genellina
On Apr 10, 12:36 pm, sophie_newbie 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 attached to it, even af

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Aaron Brady
On Apr 11, 8:09 am, Paul McGuire wrote: > On Apr 11, 2:41 am, Aaron Brady 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-bee

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 pa

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: bands: ('P',) type: I'd like to write it to a file. Apparently, I need to convert it to a string first. How do I do that? Pickle? Did you bo

Re: Definition of Pythonic?

2009-04-11 Thread MRAB
John Yeung wrote: On Apr 11, 10:08 am, Emmanuel Surleau 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 prompt. I

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 t

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 me

Re: Definition of Pythonic?

2009-04-11 Thread John Yeung
On Apr 11, 10:08 am, Emmanuel Surleau 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 prompt. I would agree with

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 wrote: > Ok, thanks again to everyone for their suggestions, even if it appears > I was going down the w

Re: Definition of Pythonic?

2009-04-11 Thread Aahz
In article , Emmanuel Surleau 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) "magical" variables like '$.'. Is this right? What >else would you include

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 user

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: bands: ('P',) type: I'd like to write it to a file. Apparently, I need to convert it to a string first. How do I do that? Pickle? Did you bother reading the PIL docu

Re: Pathological regular expression

2009-04-11 Thread John Machin
On Apr 12, 1:07 am, 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: 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.compile(r'^(([^#]+|

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. Here

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: bands: ('P',) type: I'd like to write it to a file. Apparently, I need to convert it to a string first. How do I do that? Pickle? -- W. eWatson

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 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. What physical connec

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.compile(r'^(([^#]+|\\.|"([^"\\]

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 findra...@gm

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

Re: llvm vs. parrot

2009-04-11 Thread Carlos Ribeiro
On Fri, Apr 10, 2009 at 20:16, Paul Watson wrote: > 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 made a lot of sense years

  1   2   >