ANN ChiPy January Meeting Thurs 14th 7pm

2010-01-14 Thread Brian Ray
Chicago Python User Group = Talks - ChiPy, the Chicago Python usergroup, is back again this month with another round of fantastic talks. This month we have: - A talk by the celebrated David Beazley about changes to the GIL that have been added to the Python 3

Tornado this month, PyCon Dress Rehearsal next month at PyGTA

2010-01-14 Thread Mike C. Fletcher
We've got two fun months of PyGTA lined up. This month we'll be exploring the world of the Tornado web server (http://www.tornadoweb.org), next month we've got a 3-speaker dress rehearsal for PyCon 2010. The details: Tuesday, 19th January, 2010, 7pm Tornado Hacking Tornado

Re: [Chicago] ANN ChiPy RSVP by 10am

2010-01-14 Thread Carl Karsten
Everyone is welcome but we need to let security know in advance who is coming, so if you are planning on attending, please list your name on (RSVP HERE): https://spreadsheets.google.com/viewform?formkey=dHVLOTNTU3oxTzJKYjB3RmV4eVZkMEE6MA I just found out that I was spozed to get the list in

Re: Code Generator written in python

2010-01-14 Thread Steve Ferg
http://nedbatchelder.com/code/cog/ -- http://mail.python.org/mailman/listinfo/python-list

Re: heapq._siftdown / decrease-key support?

2010-01-14 Thread Joshua Bronson
Thanks for the responses! On Thu, Jan 14, 2010 at 12:23 AM, Daniel Stutzbach dan...@stutzbachenterprises.com wrote: Your guess is correct. Someday I'd like to rewrite HeapDict in C for speed, but I haven't been able to find the time (and no one has offered to pay me to make the time ;) ).

Re: Simple distributed example for learning purposes?

2010-01-14 Thread Tim Golden
On 13/01/2010 20:24, Aahz wrote: In articlemailman.63.1261857971.28905.python-l...@python.org, Tim Goldenm...@timgolden.me.uk wrote: I'm trying to come up with something which will illustrate the usefulness of a distributed processing model. Since I may not be using the term distributed

Re: Getting access to the process table from python?

2010-01-14 Thread Simon Brunning
2010/1/13 Roy Smith r...@panix.com: I need to get information about what processes are running on a box. Right now, I'm interested in Solaris and Linux, but eventually probably other systems too.  I need to know things like the pid, command line, CPU time, when the process started running, and

Re: force URLencoding script

2010-01-14 Thread João
On Jan 12, 10:07 pm, r0g aioe@technicalbloke.com wrote: João wrote: On Jan 12, 8:05 pm, r0g aioe@technicalbloke.com wrote: João wrote: Someone please? Haven't seen your original post yet mate, usenet can be flaky like that, might have been a good idea to quote your original

maintain 2 versions of python on my computer

2010-01-14 Thread luis
Hi I am not an expert in programming and using Python for its simplicity I have 2 versions of python installed on my computer (windos xp) to begin the transition from version 2.4 to 2.6 or 3. maintaining the operability of my old scripts Is there any way to indicate the version of the python

Re: heapq._siftdown / decrease-key support?

2010-01-14 Thread Terry Reedy
On 1/14/2010 5:03 AM, Joshua Bronson wrote: Thanks for the responses! On Thu, Jan 14, 2010 at 12:23 AM, Daniel Stutzbach dan...@stutzbachenterprises.com wrote: Your guess is correct. Someday I'd like to rewrite HeapDict in C for speed, but I haven't been able to find the time (and no one

Re: maintain 2 versions of python on my computer

2010-01-14 Thread Alf P. Steinbach
* luis: Hi I am not an expert in programming and using Python for its simplicity I have 2 versions of python installed on my computer (windos xp) to begin the transition from version 2.4 to 2.6 or 3. maintaining the operability of my old scripts Is there any way to indicate the version of the

Re: Code Generator written in python

2010-01-14 Thread trzewiczek
On 01/13/2010 05:09 PM, Arnaud Delobelle wrote: nyokadanshiz...@gmail.com writes: Can someone help me with sample python code for a code generator Sure, here are some example of self-evaluating python objects, i.e. for each v below, v == eval(v) I'm quite proud of the

Re: maintain 2 versions of python on my computer

2010-01-14 Thread Gabriel Genellina
En Thu, 14 Jan 2010 08:21:28 -0300, luis soli...@gmail.com escribió: I am not an expert in programming and using Python for its simplicity I have 2 versions of python installed on my computer (windos xp) to begin the transition from version 2.4 to 2.6 or 3. maintaining the operability of my

Re: A simple-to-use sound file writer

2010-01-14 Thread Steve Holden
Alf P. Steinbach wrote: Just as a contribution, since someone hinted that I haven't really contributed much to the Python community. The [simple_sound] code will probably go into my ch 3 at url: http://tinyurl.com/programmingbookP3, but sans sine wave generation since I haven't yet

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: Just as a contribution, since someone hinted that I haven't really contributed much to the Python community. The [simple_sound] code will probably go into my ch 3 at url: http://tinyurl.com/programmingbookP3, but sans sine wave generation since I haven't

a problem with writing a generator

2010-01-14 Thread Paweł Banyś
Hello, Please forgive me if I repeat the subject anyhow. I am trying to write a simple program in Python which scans a config file in search for include lines. If those lines are found, the files included there are followed and scanned and if any further include lines are found, the whole

Re: a problem with writing a generator

2010-01-14 Thread Alf P. Steinbach
* Paweł Banyś: Hello, Please forgive me if I repeat the subject anyhow. I am trying to write a simple program in Python which scans a config file in search for include lines. If those lines are found, the files included there are followed and scanned and if any further include lines are found,

Re: a problem with writing a generator

2010-01-14 Thread Paweł Banyś
Assuming that include directives are like #include blahblah Yes, I have already tried the methods related to source code processing using Python generators but unfortunately I am dealing with BIND and its named.conf files. Regards, Paweł --

Re: a problem with writing a generator

2010-01-14 Thread Steven D'Aprano
On Thu, 14 Jan 2010 15:11:29 +0100, Paweł Banyś wrote: Hello, Please forgive me if I repeat the subject anyhow. I am trying to write a simple program in Python which scans a config file in search for include lines. If those lines are found, the files included there are followed and scanned

Re: A simple-to-use sound file writer

2010-01-14 Thread Steve Holden
Alf P. Steinbach wrote: * Steve Holden: Alf P. Steinbach wrote: Just as a contribution, since someone hinted that I haven't really contributed much to the Python community. The [simple_sound] code will probably go into my ch 3 at url: http://tinyurl.com/programmingbookP3, but sans sine wave

Re: a problem with writing a generator

2010-01-14 Thread Tim Chase
Paweł Banyś wrote: Assuming that include directives are like #include blahblah Yes, I have already tried the methods related to source code processing using Python generators but unfortunately I am dealing with BIND and its named.conf files. (dealing with BIND named.conf files doesn't

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Steve Holden: Alf P. Steinbach wrote: Just as a contribution, since someone hinted that I haven't really contributed much to the Python community. The [simple_sound] code will probably go into my ch 3 at url: http://tinyurl.com/programmingbookP3, but

Re: a problem with writing a generator

2010-01-14 Thread Wolodja Wentland
On Thu, Jan 14, 2010 at 15:11 +0100, Paweł Banyś wrote: I seem to have some blackout in my mind because I cannot understand how to use a generator functionality to complete the task. If anybody has already done such thing I would be very grateful for any guidance. I guess the following slides

Re: a problem with writing a generator

2010-01-14 Thread Dave Angel
PaweB Bany[ wrote: Hello, Please forgive me if I repeat the subject anyhow. I am trying to write a simple program in Python which scans a config file in search for include lines. If those lines are found, the files included there are followed and scanned and if any further include lines are

Writing a string.ishex function

2010-01-14 Thread chandra
Folks, I am new to Python and could not find a function along the lines of string.ishex in Python. There is however, a string.hexdigits constant in the string module. I thought I would enhance the existing modlue but am unsure how I should go about it. Specifically, I have attempted this much:

Re: Those two controversial 2nd 3rd paragraphs of my ch 1

2010-01-14 Thread Lie Ryan
On 01/14/10 11:08, Alf P. Steinbach wrote: * Daniel Fetchinson: Nobody is deliberately trying to keep people from porting! I think you misunderstand what is being said, these two statements are very different: (1) single code base working on both python versions (2) creating a second code

Re: a problem with writing a generator

2010-01-14 Thread Lie Ryan
On 01/15/10 01:49, Steven D'Aprano wrote: On Thu, 14 Jan 2010 15:11:29 +0100, Paweł Banyś wrote: Hello, Please forgive me if I repeat the subject anyhow. I am trying to write a simple program in Python which scans a config file in search for include lines. If those lines are found, the

Re: A simple-to-use sound file writer

2010-01-14 Thread Peter Otten
Alf P. Steinbach wrote: Just as a contribution, since someone hinted that I haven't really contributed much to the Python community. The [simple_sound] code will probably go into my ch 3 at url: http://tinyurl.com/programmingbookP3, but sans sine wave generation since I haven't yet

Re: A simple-to-use sound file writer

2010-01-14 Thread Steve Holden
Alf P. Steinbach wrote: * Steve Holden: [...] With the goal of just a rough approximation you can go about it like this: 1. Divide a full cycle of the sine wave into n intervals. With sine wave frequency f this corresponds to n*f sample rate for digital representation. 2.

Re: A simple-to-use sound file writer

2010-01-14 Thread Mel
Alf P. Steinbach wrote: * Steve Holden: It's not clear to me that you can approximate any waveform with a suitable combination of square waves, Oh. It's simple to prove. At least conceptually! :-) Consider first that you need an infinite number of sine waves to create a perfect square

Re: Those two controversial 2nd 3rd paragraphs of my ch 1

2010-01-14 Thread Alf P. Steinbach
* Lie Ryan - Alf P. Steinbach: why do you think it is impossible to write a complex and portable python script? I don't. You're not quoting me. Though keeping everything in one code base may often be difficult and only of little practical benefit, it is not impossible. Modern version

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Mel: Alf P. Steinbach wrote: * Steve Holden: It's not clear to me that you can approximate any waveform with a suitable combination of square waves, Oh. It's simple to prove. At least conceptually! :-) Consider first that you need an infinite number of sine waves to create a perfect

Re: Writing a string.ishex function

2010-01-14 Thread Iain King
On Jan 14, 3:52 pm, chandra chyav...@gmail.com wrote: Folks, I am new to Python and could not find a function along the lines of string.ishex in Python. There is however, a string.hexdigits constant in the string module. I thought I would enhance the existing modlue but am unsure how I

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Steve Holden: [...] With the goal of just a rough approximation you can go about it like this: 1. Divide a full cycle of the sine wave into n intervals. With sine wave frequency f this corresponds to n*f sample rate for digital

Re: Writing a string.ishex function

2010-01-14 Thread D'Arcy J.M. Cain
On Thu, 14 Jan 2010 07:52:58 -0800 (PST) chandra chyav...@gmail.com wrote: Folks, I am new to Python and could not find a function along the lines of Welcome. string.ishex in Python. There is however, a string.hexdigits constant in the string module. I thought I would enhance the existing

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Peter Otten: Alf P. Steinbach wrote: Just as a contribution, since someone hinted that I haven't really contributed much to the Python community. The [simple_sound] code will probably go into my ch 3 at url: http://tinyurl.com/programmingbookP3, but sans sine wave generation since I haven't

Re: Writing a string.ishex function

2010-01-14 Thread chandra
On Jan 15, 12:22 am, D'Arcy J.M. Cain da...@druid.net wrote: Just return False once you find a non-hex digit. def ishex(s):   for c in s:     if not c in string.hexdigits: return False   return True And here are your unit tests.  Every line should print True. print ishex('123') is True

SMTPException: No suitable authentication method found (Server: Microsoft ESMTP MAIL Service)

2010-01-14 Thread Thomas Guettler
Hi, I try to login, but I get this exception: File /home/foo/django/core/mail.py, line 137, in open self.connection.login(self.username, self.password) File /home/foo/smtplib.py, line 587, in login raise SMTPException(No suitable authentication method found.) Trace from

Re: A simple-to-use sound file writer

2010-01-14 Thread Grant Edwards
On 2010-01-14, Alf P. Steinbach al...@start.no wrote: It's not clear to me that you can approximate any waveform with a suitable combination of square waves, Oh. It's simple to prove. At least conceptually! :-) [...] With the goal of just a rough approximation you can go about it like

Re: Code Generator written in python

2010-01-14 Thread Arnaud Delobelle
trzewiczek trzewic...@trzewiczek.info writes: On 01/13/2010 05:09 PM, Arnaud Delobelle wrote: [...] Sure, here are some example of self-evaluating python objects, i.e. for each v below, v == eval(v) I'm quite proud of the last one. [...] v = \%s\ %% ((r\%s\,)*2) % ((r\%s\ %%

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Grant Edwards: On 2010-01-14, Alf P. Steinbach al...@start.no wrote: It's not clear to me that you can approximate any waveform with a suitable combination of square waves, Oh. It's simple to prove. At least conceptually! :-) [...] With the goal of just a rough approximation you can go

Re: Writing a string.ishex function

2010-01-14 Thread Chris Rebert
On Thu, Jan 14, 2010 at 8:14 AM, Iain King iaink...@gmail.com wrote: On Jan 14, 3:52 pm, chandra chyav...@gmail.com wrote: Folks, I am new to Python and could not find a function along the lines of string.ishex in Python. There is however, a string.hexdigits constant in the string module. I

Re: A simple-to-use sound file writer

2010-01-14 Thread Steve Holden
Grant Edwards wrote: On 2010-01-14, Alf P. Steinbach al...@start.no wrote: [bogus hand-waving] After all, it's the basis of digital representation of sound! Huh? I've only studied basic DSP, but I've never heard/seen that as the basis of digital represention of sound. I've also never seen

Re: Writing a string.ishex function

2010-01-14 Thread Steve Holden
chandra wrote: On Jan 15, 12:22 am, D'Arcy J.M. Cain da...@druid.net wrote: Just return False once you find a non-hex digit. def ishex(s): for c in s: if not c in string.hexdigits: return False return True And here are your unit tests. Every line should print True. print

Ignore leading '' and ellipsis?

2010-01-14 Thread Reckoner
Hi, I am studying some examples in a tutorial where there are a lot of leading characters and ellipsis in the text. This makes it hard to cut and paste into the IPython interpreter since it doesn't like these strings. Is there another interpreter I could use that will appropriately ignore and

Drawing a surface with matplotlib

2010-01-14 Thread Monnin
Hello, I have a newbie question about using matplotlib I would like to draw the surface defined by the lists X, Y and the matrix Z. I get to a nice graphical output with the following code. My problem is that the labels on the axes indicate values corresponding to the indices in Tables X and Y. I

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Steve Holden: Grant Edwards wrote: On 2010-01-14, Alf P. Steinbach al...@start.no wrote: [bogus hand-waving] After all, it's the basis of digital representation of sound! Huh? I've only studied basic DSP, but I've never heard/seen that as the basis of digital represention of sound. I've

Re: Ignore leading '' and ellipsis?

2010-01-14 Thread Javier Collado
Hello, I think that's exactly what the cpaste magic function does. Type 'cpaste?' in your IPython session for more information. Best regards, Javier 2010/1/14 Reckoner recko...@gmail.com: Hi, I am studying some examples in a tutorial where there are a lot of leading characters and

Re: Writing a string.ishex function

2010-01-14 Thread D'Arcy J.M. Cain
On Thu, 14 Jan 2010 09:07:47 -0800 Chris Rebert c...@rebertia.com wrote: Even more succinctly: def ishex(s): return all(c in string.hexdigits for c in s) I'll see your two-liner and raise you. :-) ishex = lambda s: all(c in string.hexdigits for c in s) -- D'Arcy J.M. Cain

Re: force URLencoding script

2010-01-14 Thread r0g
João wrote: On Jan 12, 10:07 pm, r0g aioe@technicalbloke.com wrote: João wrote: for the following data, authentication = UID=somestring message = 'PROBLEM severity High: OperatorX Plat1(locationY) global Succ. : 94.47%' dest_number = 'XXX' url_values =

Re: maintain 2 versions of python on my computer

2010-01-14 Thread r0g
luis wrote: Hi I am not an expert in programming and using Python for its simplicity I have 2 versions of python installed on my computer (windos xp) to begin the transition from version 2.4 to 2.6 or 3. maintaining the operability of my old scripts Is there any way to indicate the

Re: Writing a string.ishex function

2010-01-14 Thread Christian Heimes
Iain King wrote: better would be: def ishex(s): for c in s: if c not in string.hexdigits: return False return True Even more elegant and probably a faster solutions: --- from string import hexdigits hexdigits = frozenset(hexdigits) def ishex(s): return

Re: Difference Between Two datetimes

2010-01-14 Thread Steve Ferg
I'd like to start with two dates as strings, as 1961/06/16 04:35:25 and 1973/01/18 03:45:50 How do I get the strings into a shape that will accommodate a difference? Pyfdate http://www.ferg.org/pyfdate/index.html has a numsplit function that should do the trick:

Re: A simple-to-use sound file writer

2010-01-14 Thread Steve Holden
Alf P. Steinbach wrote: * Steve Holden: Grant Edwards wrote: On 2010-01-14, Alf P. Steinbach al...@start.no wrote: [bogus hand-waving] After all, it's the basis of digital representation of sound! Huh? I've only studied basic DSP, but I've never heard/seen that as the basis of digital

Re: Simple distributed example for learning purposes?

2010-01-14 Thread Mike Driscoll
On Dec 26 2009, 2:06 pm, Tim Golden m...@timgolden.me.uk wrote: I'm trying to work up a programming course using Python, aimed at secondary school students [*] here in London. One of my aims is to have a series of compact but functional examples, each demonstrating a particular field in which

Re: Writing a string.ishex function

2010-01-14 Thread Arnaud Delobelle
D'Arcy J.M. Cain da...@druid.net writes: On Thu, 14 Jan 2010 09:07:47 -0800 Chris Rebert c...@rebertia.com wrote: Even more succinctly: def ishex(s): return all(c in string.hexdigits for c in s) I'll see your two-liner and raise you. :-) ishex = lambda s: all(c in string.hexdigits

unittest help needed!

2010-01-14 Thread Oltmans
Hi Python gurus, I'm quite new to Python and have a problem. Following code resides in a file named test.py --- import unittest class result(unittest.TestResult): pass class tee(unittest.TestCase): def test_first(self): print 'first test' print '-' def

Re: Writing a string.ishex function

2010-01-14 Thread MRAB
D'Arcy J.M. Cain wrote: On Thu, 14 Jan 2010 07:52:58 -0800 (PST) chandra chyav...@gmail.com wrote: Folks, I am new to Python and could not find a function along the lines of Welcome. string.ishex in Python. There is however, a string.hexdigits constant in the string module. I thought I

Re: Writing a string.ishex function

2010-01-14 Thread Phlip
MRAB wrote: BTW, ishex('') should return False. So should int('')! -- http://mail.python.org/mailman/listinfo/python-list

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Steve Holden: Grant Edwards wrote: On 2010-01-14, Alf P. Steinbach al...@start.no wrote: [bogus hand-waving] After all, it's the basis of digital representation of sound! Huh? I've only studied basic DSP, but I've never heard/seen that as the

Re: unittest help needed!

2010-01-14 Thread exarkun
On 06:33 pm, rolf.oltm...@gmail.com wrote: Hi Python gurus, I'm quite new to Python and have a problem. Following code resides in a file named test.py --- import unittest class result(unittest.TestResult): pass class tee(unittest.TestCase): def test_first(self): print 'first

Re: Writing a string.ishex function

2010-01-14 Thread MRAB
Arnaud Delobelle wrote: D'Arcy J.M. Cain da...@druid.net writes: On Thu, 14 Jan 2010 09:07:47 -0800 Chris Rebert c...@rebertia.com wrote: Even more succinctly: def ishex(s): return all(c in string.hexdigits for c in s) I'll see your two-liner and raise you. :-) ishex = lambda s: all(c

Re: thanks casevh and Lee

2010-01-14 Thread Dave WB3DWE
Thanks Lee casevh. I'm going to remove all python 3 versions, update to Ubuntu 9.10 and then do a clean installation of python 3.1.1 via Synaptic. Dave WB3DWE -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing a string.ishex function

2010-01-14 Thread MRAB
Phlip wrote: MRAB wrote: BTW, ishex('') should return False. So should int('')! Why? -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest help needed!

2010-01-14 Thread Oltmans
On Jan 14, 11:46 pm, exar...@twistedmatrix.com wrote: When you run test.py, it gets to the loadTestsFromName line.  There, it imports the module named test in order to load tests from it.  To import that module, it runs test.py again.  By the time it finishes running the contents of test.py

Re: interactive terminal in Ubuntu Linux : libreadline5-dev works only in Python 2.6 not 3.1

2010-01-14 Thread Dave WB3DWE
The python 3 version in the 9.10 repo is 3.1.1 Actually, if I/O is important, I'd recommend a full install of 9.10 so that you can get the ext4 file system. I have found it offers some very impressive speedups with the disk -- especially for deleting files. Thanks casevh and Lee. I intend to

Re: Author of a Python Success Story Needs a Job!

2010-01-14 Thread Paul Rubin
a...@pythoncraft.com (Aahz) writes: Incidentally, my company has had a fair amount of difficulty finding Python programmers -- anyone in the SF area looking for a job near Mountain View? I'm surprised there aren't a ton of Python programmers there, given that's where Brand G is and so forth.

Re: Writing a string.ishex function

2010-01-14 Thread Duncan Booth
MRAB pyt...@mrabarnett.plus.com wrote: I raise you one character: ishex2 = lambda s: not(set(s)-set(string.hexdigits)) # Yours ishex3 = lambda s: not set(s)-set(string.hexdigits) # Mine I could actually go three better: ishex3=lambda s:not set(s)-set(string.hexdigits) But

Re: Python and Tkinter Programming by John Grayson

2010-01-14 Thread Mark Roseman
Peter peter.milli...@gmail.com wrote: Besides, the book is mainly about using Python with Tkinter - and Tkinter hasn't changed that much since 2000, so I believe it is just as relevant today as it was back then. I'd say that Tkinter has substantially changed - with the introduction of the

Re: Writing a string.ishex function

2010-01-14 Thread Jean-Michel Pichavant
Phlip wrote: MRAB wrote: BTW, ishex('') should return False. So should int('')! Did you mean isint('') ? JM -- http://mail.python.org/mailman/listinfo/python-list

Re: Author of a Python Success Story Needs a Job!

2010-01-14 Thread Robert Kern
On 2010-01-14 13:14 PM, Paul Rubin wrote: a...@pythoncraft.com (Aahz) writes: Incidentally, my company has had a fair amount of difficulty finding Python programmers -- anyone in the SF area looking for a job near Mountain View? I'm surprised there aren't a ton of Python programmers there,

Re: Author of a Python Success Story Needs a Job!

2010-01-14 Thread Jean-Michel Pichavant
Paul Rubin wrote: a...@pythoncraft.com (Aahz) writes: Incidentally, my company has had a fair amount of difficulty finding Python programmers -- anyone in the SF area looking for a job near Mountain View? I'm surprised there aren't a ton of Python programmers there, given that's where

Invalid Syntax Error

2010-01-14 Thread Ray Holt
Why am I getting an invalid systax on the first except in the following code. It was copid from the python tutorial for beginners. Thanks, Ray import sys try: #open file stream file = open(file_name, w except IOError: print There was an error writing to, file_name sys.exit() print

Re: Writing a string.ishex function

2010-01-14 Thread MRAB
Duncan Booth wrote: MRAB pyt...@mrabarnett.plus.com wrote: I raise you one character: ishex2 = lambda s: not(set(s)-set(string.hexdigits)) # Yours ishex3 = lambda s: not set(s)-set(string.hexdigits) # Mine I could actually go three better: ishex3=lambda s:not

Re: unittest help needed!

2010-01-14 Thread Phlip
Oltmans wrote: def test_first(self): print 'first test' process(123) All test cases use the pattern Assemble Activate Assert. You are assembling a 123, and activating process(), but where is your assert? If it is inside process() (if process is a test-side method), then

Re: Invalid Syntax Error

2010-01-14 Thread MRAB
Ray Holt wrote: Why am I getting an invalid systax on the first except in the following code. It was copid from the python tutorial for beginners. Thanks, Ray import sys try: #open file stream file = open(file_name, w [snip] Missing ). --

Re: Invalid Syntax Error

2010-01-14 Thread Benjamin Kaplan
How about you just isolate the first few lines On Thu, Jan 14, 2010 at 2:43 PM, Ray Holt mrhol...@sbcglobal.net wrote: try:     #open file stream     file = open(file_name, w except IOError:     print There was an error writing to, file_name     sys.exit() Notice anything now? Something

Re: Writing a string.ishex function

2010-01-14 Thread D'Arcy J.M. Cain
On 14 Jan 2010 19:19:53 GMT Duncan Booth duncan.bo...@invalid.invalid wrote: ishex2 = lambda s: not(set(s)-set(string.hexdigits)) # Yours ishex3 = lambda s: not set(s)-set(string.hexdigits) # Mine I could actually go three better: ishex3=lambda s:not

Re: Writing a string.ishex function

2010-01-14 Thread D'Arcy J.M. Cain
On Thu, 14 Jan 2010 18:36:12 + MRAB pyt...@mrabarnett.plus.com wrote: print ishex('123') is True print ishex('abc') is True print ishex('xyz') is False print ishex('0123456789abcdefABCDEF') is True print ishex('0123456789abcdefABCDEFG') is False Don't use 'is', use '=='. Why?

Re: Author of a Python Success Story Needs a Job!

2010-01-14 Thread Aahz
In article mailman.929.1263497441.28905.python-l...@python.org, Robert Kern robert.k...@gmail.com wrote: On 2010-01-14 13:14 PM, Paul Rubin wrote: a...@pythoncraft.com (Aahz) writes: Incidentally, my company has had a fair amount of difficulty finding Python programmers -- anyone in the SF

Re: Author of a Python Success Story Needs a Job!

2010-01-14 Thread Aahz
In article 7x4omosdly@ruckus.brouhaha.com, Paul Rubin no.em...@nospam.invalid wrote: a...@pythoncraft.com (Aahz) writes: Incidentally, my company has had a fair amount of difficulty finding Python programmers -- anyone in the SF area looking for a job near Mountain View? I'm surprised

Re: Writing a string.ishex function

2010-01-14 Thread exarkun
On 08:15 pm, da...@druid.net wrote: On 14 Jan 2010 19:19:53 GMT Duncan Booth duncan.bo...@invalid.invalid wrote: ishex2 = lambda s: not(set(s)-set(string.hexdigits)) # Yours ishex3 = lambda s: not set(s)-set(string.hexdigits) # Mine I could actually go three better: ishex3=lambda

Re: Writing a string.ishex function

2010-01-14 Thread Arnaud Delobelle
MRAB pyt...@mrabarnett.plus.com writes: Arnaud Delobelle wrote: D'Arcy J.M. Cain da...@druid.net writes: On Thu, 14 Jan 2010 09:07:47 -0800 Chris Rebert c...@rebertia.com wrote: Even more succinctly: def ishex(s): return all(c in string.hexdigits for c in s) I'll see your two-liner

Re: Python and Tkinter Programming by John Grayson

2010-01-14 Thread Peter
On Jan 15, 6:24 am, Mark Roseman m...@markroseman.com wrote:  Peter peter.milli...@gmail.com wrote: Besides, the book is mainly about using Python with Tkinter - and Tkinter hasn't changed that much since 2000, so I believe it is just as relevant today as it was back then. I'd say that

PyQT 4.6.2 question about radiobuttons

2010-01-14 Thread News123
Hi, As you wll notice: I don't have a lot of GUI and only very litte PyQT-experience. I have a UI created with qt designer. The UI contains a few named radio buttons in a button group. ( for example radioButton_one to radioButton_four ) I am unable locate a signal, that is fired whenever one

Re: PyQT 4.6.2 question about radiobuttons

2010-01-14 Thread Phil Thompson
On Thu, 14 Jan 2010 22:09:20 +0100, News123 news...@free.fr wrote: Hi, As you wll notice: I don't have a lot of GUI and only very litte PyQT-experience. I have a UI created with qt designer. The UI contains a few named radio buttons in a button group. ( for example radioButton_one to

Re: Bare Excepts

2010-01-14 Thread Aahz
In article 034fd208$0$1277$c3e8...@news.astraweb.com, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Sat, 02 Jan 2010 09:40:44 -0800, Aahz wrote: OTOH, if you want to do something different depending on whether the file exists, you need to use both approaches: if

Executable standalone *.pyc after inserting #!/usr/bin/python or other options

2010-01-14 Thread epsilon
All: I've been playing with Lua and found something really cool that I'm unable to do in Python. With Lua, a script can be compiled to byte code using luac and by adding #!/usr/bin/lua at the top of the binary, the byte code becomes a single file executable. After I found this trick, I ran back

Re: Writing a string.ishex function

2010-01-14 Thread Terry Reedy
On 1/14/2010 12:44 PM, D'Arcy J.M. Cain wrote: On Thu, 14 Jan 2010 09:07:47 -0800 Chris Rebertc...@rebertia.com wrote: Even more succinctly: def ishex(s): return all(c in string.hexdigits for c in s) I'll see your two-liner and raise you. :-) ishex = lambda s: all(c in

Re: Python and Tkinter Programming by John Grayson

2010-01-14 Thread Kevin Walzer
On 1/14/10 3:39 PM, Peter wrote: On Jan 15, 6:24 am, Mark Rosemanm...@markroseman.com wrote: Peterpeter.milli...@gmail.com wrote: Besides, the book is mainly about using Python with Tkinter - and Tkinter hasn't changed that much since 2000, so I believe it is just as relevant today as it

Re: Author of a Python Success Story Needs a Job!

2010-01-14 Thread Novocastrian_Nomad
Why is it so many, so called high tech companies, insist on the 19th century practice of demanding an employee's physical presence in a specific geographic location. This is the 21st century with climate change, carbon footprints, broadband internet, telecommuting, tele-presence, telephones, fax

SAGE help support?

2010-01-14 Thread Lou Pecora
Does anyone know of any SAGE support or help newsgroups or email lists? I know this is not a SAGE group and there is at least one support group for SAGE (http://groups.google.com/group/sage-support/), but I have gone there and asked similar questions twice and gotten zero replies (it's been

Re: A simple-to-use sound file writer

2010-01-14 Thread Lie Ryan
On 01/15/10 05:42, Alf P. Steinbach wrote: I'm beginning to believe that you maybe didn't grok that simple procedure. It's very very very trivial, so maybe you were looking for something more intricate -- they used to say, in the old days, hold on, this proof goes by so fast you may not

Re: Ignore leading '' and ellipsis?

2010-01-14 Thread Rhodri James
On Thu, 14 Jan 2010 17:13:54 -, Reckoner recko...@gmail.com wrote: I am studying some examples in a tutorial where there are a lot of leading characters and ellipsis in the text. This makes it hard to cut and paste into the IPython interpreter since it doesn't like these strings. Is there

Re: Writing a string.ishex function

2010-01-14 Thread MRAB
Arnaud Delobelle wrote: MRAB pyt...@mrabarnett.plus.com writes: Arnaud Delobelle wrote: D'Arcy J.M. Cain da...@druid.net writes: On Thu, 14 Jan 2010 09:07:47 -0800 Chris Rebert c...@rebertia.com wrote: Even more succinctly: def ishex(s): return all(c in string.hexdigits for c in s)

[ANN] Python 2.5.5 Release Candidate 1.

2010-01-14 Thread Martin v. Löwis
On behalf of the Python development team and the Python community, I'm happy to announce the release candidate 1 of Python 2.5.5. This is a source-only release that only includes security fixes. The last full bug-fix release of Python 2.5 was Python 2.5.4. Users are encouraged to upgrade to the

Re: Simple distributed example for learning purposes?

2010-01-14 Thread CM
On Dec 26 2009, 3:46 pm, Shawn Milochik sh...@milochik.com wrote: The special features of the Shrek DVD showed how the rendering took so much processing power that everyone's workstation was used overnight as a rendering farm. Some kind of video rendering would make a great example.

Re: Executable standalone *.pyc after inserting #!/usr/bin/python or other options

2010-01-14 Thread Martin v. Loewis
I've been playing with Lua and found something really cool that I'm unable to do in Python. With Lua, a script can be compiled to byte code using luac and by adding #!/usr/bin/lua at the top of the binary, the byte code becomes a single file executable. After I found this trick, I ran back to

Re: maintain 2 versions of python on my computer

2010-01-14 Thread Lie Ryan
On 01/14/10 22:21, luis wrote: Hi I am not an expert in programming and using Python for its simplicity I have 2 versions of python installed on my computer (windos xp) to begin the transition from version 2.4 to 2.6 or 3. maintaining the operability of my old scripts Is there any

Re: Author of a Python Success Story Needs a Job!

2010-01-14 Thread Aahz
In article 6a12ed15-e7f9-43ab-9b90-984525808...@o28g2000yqh.googlegroups.com, Novocastrian_Nomad gregory.j.ba...@gmail.com wrote: Why is it so many, so called high tech companies, insist on the 19th century practice of demanding an employee's physical presence in a specific geographic location.

  1   2   3   >