Re: Yet another Python textbook

2012-11-19 Thread Ian Kelly
On Sun, Nov 18, 2012 at 10:30 PM, Pavel Solin wrote: > I would like to introduce a new Python textbook > aimed at high school students: > > http://femhub.com/textbook-python/. > > The textbook is open source and its public Git > repository is located at Github: > > g...@github.com:femhub/nclab-tex

Re: Problems on these two questions

2012-11-19 Thread Ian Kelly
On Mon, Nov 19, 2012 at 4:15 PM, Dennis Lee Bieber wrote: > On Sun, 18 Nov 2012 17:52:35 -0800 (PST), su29090 <129k...@gmail.com> > declaimed the following in gmane.comp.python.general: > >> >> I all of the other problems but I have issues with these: >> >> 1.Given a positive integer n , assign T

Re: xml data or other?

2012-11-19 Thread Stefan Behnel
Prasad, Ramit, 19.11.2012 22:42: > Artie Ziff wrote: >> Writing XML files so to see whats happening. My plan is to >> keep xml data in memory and parse with xml.etree.ElementTree. >> >> Unfortunately, xml parsing fails due to angle brackets inside >> description tags. In particular, xml.etree.Eleme

Re: Getting a seeded value from a list

2012-11-19 Thread frednotbob
> > Are you generating the entire level on entry, or as each room is > > "opened" (if, "as opened", you have the complication that going down a > > level and back up will result in different random numbers vs going > > straight to the room). > > > > Generating on entry only needs

Re: changing process name

2012-11-19 Thread Tim Roberts
andrea crotti wrote: >I have very long processes to spawn which I want to lauch as separate >processes (and communicate with ZeroMQ), but now the problem is that the >forked process appears in "ps" with the same name as the launcher >process. http://code.google.com/p/py-setproctitle/ -- Tim Rob

Re: Python Interview Questions

2012-11-19 Thread Roy Smith
In article <50aac66c$0$29983$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > I'm asking about the case where one might want the key to remain mutable > even after it is used as a key, but can't because Python won't let you. Ah. Now I see what you're getting at. Thank you. Well

Re: Yet another Python textbook

2012-11-19 Thread alex23
On Nov 20, 2:58 am, Kwpolska wrote: > You are writing it for something called “NCLab”, not for the general > public, and that sucks. And making it available to the general public to consume. What's wrong with writing for one audience and providing for a broader? If you're that concerned with the

Re: Python Interview Questions

2012-11-19 Thread Roy Smith
In article <50aac3d8$0$29983$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > By the way, your news client seems to be mangling long URLs, by splitting > them when they exceed the maximum line length. Hmmm. So it did. My bad. -- http://mail.python.org/mailman/listinfo/python-li

[OT]Two-tonne Witch computer gets a reboot

2012-11-19 Thread Mark Lawrence
You may find this interesting http://www.bbc.co.uk/news/technology-20395212 -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems on these two questions

2012-11-19 Thread Dave Angel
On 11/19/2012 06:16 PM, Dennis Lee Bieber wrote: > On Sun, 18 Nov 2012 21:18:19 -0500, Dave Angel declaimed > the following in gmane.comp.python.general: > > >> if is_a_prime(n): >> is_prime = True >> >> Now all you have to do is write is_a_prime(). if you get stuck, please >> show us what yo

Re: Linux compatibility

2012-11-19 Thread Steven D'Aprano
On Mon, 19 Nov 2012 08:44:37 -0800, EDI Support wrote: > Hi All, > > I would like know if Python 2.4.3 will be compatible with Linux RHEL > 5.5 or 6.1? I don't see any reason why it wouldn't be, but why would you want to use Python 2.4 in production if you don't have to? RHEL will come with Py

Re: re.search when used within an if/else fails

2012-11-19 Thread Steven D'Aprano
On Mon, 19 Nov 2012 15:43:10 -0800, Kevin T wrote: > python version 2.4.3, yes i know that it is old. getting the sysadmin > to update the OS requires a first born. > > with the following code.. > for signal in register['signals'] : > > 351 sigName = signal['fu

Re: re.search when used within an if/else fails

2012-11-19 Thread Steven D'Aprano
On Tue, 20 Nov 2012 01:24:54 +, Steven D'Aprano wrote: > Your code is mangled to the point of unreadability. Ah, never mind, that's *my* fault, not yours. Or rather, my news reader software. Sorry about the noise. The rest of my post still stands: - simplify your example to the simplest e

Re: re.search when used within an if/else fails

2012-11-19 Thread MRAB
On 2012-11-19 23:43, Kevin T wrote: python version 2.4.3, yes i know that it is old. getting the sysadmin to update the OS requires a first born. with the following code.. for signal in register['signals'] : 351 sigName = signal['functionName'] 352

Re: Splitting a line while keeping quoted items together

2012-11-19 Thread Tim Chase
>> Use the "shlex" module in the std lib? > > Well color me ignorant. > > Works cleanly. I shouldn't have reinvented the wheel. I've experienced this enough: the csv module, option parsing, config-file parsing, logging, timeit, and pwd all come to mind as code I've written before realizing the s

Re: Stack_overflow error

2012-11-19 Thread Chris Angelico
On Tue, Nov 20, 2012 at 11:49 AM, Aung Thet Naing wrote: > I'm having Stack_overflow exception in _ctypes_callproc (callproc.c). The > error actually come from the: > > cleanup: > for (i = 0; i < argcount; ++i) > Py_XDECREF(args[i].keep); > > when args[i].keep->ob_refCnt == 1 Can yo

Re: Splitting a line while keeping quoted items together

2012-11-19 Thread Steven D'Aprano
On Mon, 19 Nov 2012 16:05:30 -0800, josh wrote: > I am working on a cmd.Cmd-based program, and normally could just split > the string and get the right parts. > > Now I have a case where I could have two or three words in the string > that need to be grouped into the same thing. Try shlex.split.

Stack_overflow error

2012-11-19 Thread Aung Thet Naing
I'm having Stack_overflow exception in _ctypes_callproc (callproc.c). The error actually come from the: cleanup: for (i = 0; i < argcount; ++i) Py_XDECREF(args[i].keep); when args[i].keep->ob_refCnt == 1 Aung. -- http://mail.python.org/mailman/listinfo/python-list

Re: Linux compatibility

2012-11-19 Thread Cameron Simpson
On Mon, 19 Nov 2012 08:44:37 -0800 (PST), EDI Support | declaimed the following in | gmane.comp.python.general: | > I would like know if Python 2.4.3 will be compatible with Linux RHEL 5.5 or 6.1? It would help if you could qualify what you imagine "compatible with" to mean... On 19Nov2012 18:

re[2]: Splitting a line while keeping quoted items together

2012-11-19 Thread Joshua R English
Well color me ignorant. Works cleanly. I shouldn't have reinvented the wheel. Thanks.   This seem really ugly. Is there a cleaner way to do this? Is there a keyword I could search by to find something nicer? Use the "shlex" module in the std lib? Cheers, Chris -- Cheers,Chris--http://rebertia.

Re: Splitting a line while keeping quoted items together

2012-11-19 Thread Chris Rebert
On Monday, November 19, 2012, wrote: > I am working on a cmd.Cmd-based program, and normally could just split the > string and get the right parts. > > Now I have a case where I could have two or three words in the string that > need to be grouped into the same thing. > > Then I realized that I'm

Splitting a line while keeping quoted items together

2012-11-19 Thread josh
I am working on a cmd.Cmd-based program, and normally could just split the string and get the right parts. Now I have a case where I could have two or three words in the string that need to be grouped into the same thing. Then I realized that I'm not the only person who has had to deal with thi

RE: Python Interview Questions

2012-11-19 Thread Prasad, Ramit
Roy Smith wrote: > > OK, I've just read back over the whole thread. I'm really struggling to > understand what point you're trying to make. I started out by saying: > > > Use a list when you need an ordered collection which is mutable (i.e. > > can be altered after being created). Use a tuple

Re: Python Interview Questions

2012-11-19 Thread Steven D'Aprano
On Mon, 19 Nov 2012 09:59:19 -0500, Roy Smith wrote: > OK, I've just read back over the whole thread. I'm really struggling to > understand what point you're trying to make. I started out by saying: > >> Use a list when you need an ordered collection which is mutable (i.e. >> can be altered aft

Re: Python Interview Questions

2012-11-19 Thread Steven D'Aprano
On Mon, 19 Nov 2012 09:30:54 -0500, Roy Smith wrote: > In article <50a9e5cf$0$21863$c3e8da3$76491...@news.astraweb.com>, > Steven D'Aprano wrote: > >> I see. It wasn't clear from your earlier description that the items had >> been post-processed from collections of raw log lines to fixed record

re.search when used within an if/else fails

2012-11-19 Thread Kevin T
python version 2.4.3, yes i know that it is old. getting the sysadmin to update the OS requires a first born. with the following code.. for signal in register['signals'] : 351 sigName = signal['functionName'] 352 if re.search( "rsrvd", sigName

RE: Robust regex

2012-11-19 Thread Joseph L. Casale
> Regexes may be overkill here. A simple string split might be better: Yup, and much more robust as I was looking for. Thanks everyone! jlc -- http://mail.python.org/mailman/listinfo/python-list

RE: xml data or other?

2012-11-19 Thread Prasad, Ramit
Artie Ziff wrote: > > On 11/9/12 5:50 AM, rusi wrote: > > On Nov 9, 5:54 pm, Artie Ziff wrote: > > # submit correctedinput to etree > I was very grateful to get the "leg up" on getting started down that > right path with my coding. Many thanks to you, rusi. I took your > excellent advices and hav

Re: Python questions help

2012-11-19 Thread Chris Angelico
On Tue, Nov 20, 2012 at 1:57 AM, Neil Cerutti wrote: > On 2012-11-16, Chris Angelico wrote: >> On Sat, Nov 17, 2012 at 5:00 AM, rh >> wrote: >>> "How many people think programming skills are inherent?" i.e. >>> that some people are just born with the gift to be good >>> programmers Result: very

Re: Point of idle curiosity

2012-11-19 Thread Chris Angelico
On Mon, Nov 19, 2012 at 11:38 PM, Ulrich Eckhardt wrote: > Am 18.11.2012 12:45, schrieb Chris Angelico: >> Is IDLE named after Eric of that name, or is it pure coincidence? > > > Maybe. Interestingly, there is also http://eric-ide.python-projects.org/, > just to add some more unfounded conspiracy

Re: Robust regex

2012-11-19 Thread John Gordon
In "Joseph L. Casale" writes: > Trying to robustly parse a string that will have key/value pairs separated > by three pipes, where each additional key/value (if more than one exists) > will be delineated by four more pipes. > string = 'key_1|||value_1key_2|||value_2' > regex = '((?:

Re: Robust regex

2012-11-19 Thread MRAB
On 2012-11-19 20:32, Joseph L. Casale wrote: Trying to robustly parse a string that will have key/value pairs separated by three pipes, where each additional key/value (if more than one exists) will be delineated by four more pipes. string = 'key_1|||value_1key_2|||value_2' regex =

Re: Point of idle curiosity

2012-11-19 Thread Alister
On Sun, 18 Nov 2012 16:08:34 +, Mark Lawrence wrote: > On 18/11/2012 15:59, Steven D'Aprano wrote: >> On Sun, 18 Nov 2012 22:45:43 +1100, Chris Angelico wrote: >> >>> (if you'll forgive the pun) >>> >>> Is IDLE named after Eric of that name, or is it pure coincidence? >> >> Well, IDLE is an ID

Re: Robust regex

2012-11-19 Thread Benjamin Kaplan
On Nov 19, 2012 12:37 PM, "Joseph L. Casale" wrote: > > Trying to robustly parse a string that will have key/value pairs separated > by three pipes, where each additional key/value (if more than one exists) > will be delineated by four more pipes. > > string = 'key_1|||value_1key_2|||value

Re: Robust regex

2012-11-19 Thread Chris Angelico
On Tue, Nov 20, 2012 at 7:32 AM, Joseph L. Casale wrote: > Trying to robustly parse a string that will have key/value pairs separated > by three pipes, where each additional key/value (if more than one exists) > will be delineated by four more pipes. > > string = 'key_1|||value_1key_2|||va

Re: Python Interview Questions

2012-11-19 Thread Terry Reedy
On 11/19/2012 9:30 AM, Roy Smith wrote: Our requirements are to scan the logs of a production site and filter down the gobs and gobs of output (we produced 70 GB of log files yesterday) into something small enough that a human can see what the most common failures were. The tool I wrote does th

Robust regex

2012-11-19 Thread Joseph L. Casale
Trying to robustly parse a string that will have key/value pairs separated by three pipes, where each additional key/value (if more than one exists) will be delineated by four more pipes. string = 'key_1|||value_1key_2|||value_2' regex = '((?:(?!\|\|\|).)+)(?:\|\|\|)((?:(?!\|\|\|).)+)(

Re: Paid Python work for 30mins - 1 hour

2012-11-19 Thread Paul Rubin
Mark Adam writes: > You might consider putting your request on elance.com or guru.com > where you can hire programmers for small projects like this. Even though the coding task is very small, I think it's unrealistic to scope it at less than 2-4 hours, given communication overhead etc. It would

Re: Paid Python work for 30mins - 1 hour

2012-11-19 Thread Mark Adam
On Mon, Nov 19, 2012 at 10:14 AM, wrote: > I have three scripts that I would like written, they are designed to do the > following: > > Backup.py – Zip a folder and store it on amazon S3 using BOTO with the date > and time as the folder name. > > Restore.py – Grab a file from S3 and download it

Re: Paid Python work for 30mins - 1 hour

2012-11-19 Thread Paul Rubin
blockedu...@gmail.com writes: > I have three scripts that I would like written, they are designed to > do the following: > Backup.py – Zip a folder and store it on amazon S3 ... > If you are interested get in touch! You could just type "python s3 upload" into web search and see if you can use the

Re: Yet another Python textbook

2012-11-19 Thread Kwpolska
On Mon, Nov 19, 2012 at 6:30 AM, Pavel Solin wrote: > I would like to introduce a new Python textbook > aimed at high school students: > > http://femhub.com/textbook-python/. > > The textbook is open source and its public Git > repository is located at Github: > > g...@github.com:femhub/nclab-text

Linux compatibility

2012-11-19 Thread EDI Support
Hi All, I would like know if Python 2.4.3 will be compatible with Linux RHEL 5.5 or 6.1? Thanks Tony -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Interview Questions

2012-11-19 Thread Ian Kelly
On Mon, Nov 19, 2012 at 7:30 AM, Roy Smith wrote: > In article <50a9e5cf$0$21863$c3e8da3$76491...@news.astraweb.com>, > Steven D'Aprano wrote: >> >> By the way, based on the sample data you show, your script is possibly >> broken. You don't record either the line number that raises, or the >> ex

Re: Paid Python work for 30mins - 1 hour

2012-11-19 Thread blockeduser
Forgot to say, my email is blockedu...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Paid Python work for 30mins - 1 hour

2012-11-19 Thread blockeduser
I have three scripts that I would like written, they are designed to do the following: Backup.py – Zip a folder and store it on amazon S3 using BOTO with the date and time as the folder name. Restore.py – Grab a file from S3 and download it and then unzip it in the right location with two comm

Re: "Premature end of script headers: wsgihandler.py" on usage of BytesIO()

2012-11-19 Thread Hans Mulder
On 19/11/12 14:29:13, Yasir Saleem wrote: > Hi all, > > I am generating graphs using "cairo plot" in web2py project. > Here I am using BytesIO() stream for generating graphs. > Everything runs fine when I run on localhost but when I deploy > it on apache server and then run from different machines

Re: Python Interview Questions

2012-11-19 Thread Roy Smith
OK, I've just read back over the whole thread. I'm really struggling to understand what point you're trying to make. I started out by saying: > Use a list when you need an ordered collection which is mutable (i.e. > can be altered after being created). Use a tuple when you need an > immutabl

Re: Python questions help

2012-11-19 Thread Neil Cerutti
On 2012-11-16, Chris Angelico wrote: > On Sat, Nov 17, 2012 at 5:00 AM, rh > wrote: >> "How many people think programming skills are inherent?" i.e. >> that some people are just born with the gift to be good >> programmers Result: very few hands raised maybe a couple >> (possibly non-progammers??

Re: Python Interview Questions

2012-11-19 Thread Roy Smith
In article <50a9e5cf$0$21863$c3e8da3$76491...@news.astraweb.com>, Steven D'Aprano wrote: > I see. It wasn't clear from your earlier description that the items had > been post-processed from collections of raw log lines to fixed records. Well, I did provide the code that does this. > But it d

Re: error importing smtplib

2012-11-19 Thread Eric Frederich
I can do this in stand alone programs because my code does the import and calls the login function so I can control the order of things. Unfortunately stand alone programs are not the only ways in which I am using these Python bindings. You can customize and extend this 3rd party application at va

"Premature end of script headers: wsgihandler.py" on usage of BytesIO()

2012-11-19 Thread Yasir Saleem
Hi all, I am generating graphs using "cairo plot" in web2py project. Here I am using BytesIO() stream for generating graphs. Everything runs fine when I run on localhost but when I deploy it on apache server and then run from different machines OR from different browsers in same machine then th

Re: Point of idle curiosity

2012-11-19 Thread Ulrich Eckhardt
Am 18.11.2012 12:45, schrieb Chris Angelico: (if you'll forgive the pun) Nevarr! Is IDLE named after Eric of that name, or is it pure coincidence? Maybe. Interestingly, there is also http://eric-ide.python-projects.org/, just to add some more unfounded conspiracy theories to this discuss

Re: Python Interview Questions

2012-11-19 Thread Terry Reedy
On 11/19/2012 1:01 AM, Ian Kelly wrote: than tuple access. Tuples are as fast as or faster than lists, pretty much universally. They seem to have closed the gap a bit in Python 3.3, though, as the following timings show. For one-shot construction, tuples seem to be more efficient for short se