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 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 ;) ). Daniel, did you realize you c

Re: Simple distributed example for learning purposes?

2010-01-14 Thread Tim Golden
On 13/01/2010 20:24, Aahz wrote: In article, Tim Golden 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" exactly, my criteria are: Distributed spider with firewall that limits n

Re: Getting access to the process table from python?

2010-01-14 Thread Simon Brunning
2010/1/13 Roy Smith : > 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 owner. > >

Re: force URLencoding script

2010-01-14 Thread João
On Jan 12, 10:07 pm, r0g wrote: > João wrote: > > On Jan 12, 8:05 pm, r0g 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 post! > > >> Roger. > > > Thanks Roger. > >

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 in

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

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: nyoka 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 last one. v = (lambda x

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 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 old scripts Is ther

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 http://tinyurl.com/programmingbookP3>, but sans sine wave generation > since I haven't yet discusse

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 http://tinyurl.com/programmingbookP3>, but sans sine wave generation since I haven't yet

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 proc

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 foun

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ł -- http://mail.python.org/mailman/listinfo/pyt

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

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 >> http://tinyurl.com/programmingbookP3>, but sa

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 so

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 http://tinyurl.com/programmingbookP3>, but sans

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 slid

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 seco

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 f

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 http://tinyurl.com/programmingbookP3>, but sans sine wave generation since > I haven't yet discuss

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

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

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 cont

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 squar

Re: Writing a string.ishex function

2010-01-14 Thread Iain King
On Jan 14, 3:52 pm, chandra 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 should go about it

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 representat

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 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 modlue > but a

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 http://tinyurl.com/programmingbookP3>, but sans sine wave generation since I haven't yet

Re: Writing a string.ishex function

2010-01-14 Thread chandra
On Jan 15, 12:22 am, "D'Arcy J.M. Cain" 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 tcpdum

Re: A simple-to-use sound file writer

2010-01-14 Thread Grant Edwards
On 2010-01-14, Alf P. Steinbach 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 this: > >

Re: Code Generator written in python

2010-01-14 Thread Arnaud Delobelle
trzewiczek 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\" %% ((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 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 t

Re: Writing a string.ishex function

2010-01-14 Thread Chris Rebert
On Thu, Jan 14, 2010 at 8:14 AM, Iain King wrote: > On Jan 14, 3:52 pm, chandra 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 th

Re: A simple-to-use sound file writer

2010-01-14 Thread Steve Holden
Grant Edwards wrote: > On 2010-01-14, Alf P. Steinbach 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 that re

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

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 an

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 w

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 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: 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 : > > Hi, > > I am studying some examples in a tutorial where there are a lot of > leading >>> characters and ellipsis in th

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 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 | Democracy is

Re: force URLencoding script

2010-01-14 Thread r0g
João wrote: > On Jan 12, 10:07 pm, r0g 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 = urlencode({'M':message}) > enc_

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

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: http://www.ferg.org/pyf

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

Re: Simple distributed example for learning purposes?

2010-01-14 Thread Mike Driscoll
On Dec 26 2009, 2:06 pm, Tim Golden 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 > Python (and pro

Re: Writing a string.ishex function

2010-01-14 Thread Arnaud Delobelle
"D'Arcy J.M. Cain" writes: > On Thu, 14 Jan 2010 09:07:47 -0800 > Chris Rebert 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) I's

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

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

Re: unittest help needed!

2010-01-14 Thread exarkun
On 06:33 pm, [email protected] 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 te

Re: Writing a string.ishex function

2010-01-14 Thread MRAB
Arnaud Delobelle wrote: "D'Arcy J.M. Cain" writes: On Thu, 14 Jan 2010 09:07:47 -0800 Chris Rebert 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

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, [email protected] 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 t

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
[email protected] (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 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 none of those pass you

Re: Python and Tkinter Programming by John Grayson

2010-01-14 Thread Mark Roseman
Peter 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 'ttk' themed widgets.

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: [email protected] (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, giv

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

2010-01-14 Thread Jean-Michel Pichavant
Paul Rubin wrote: [email protected] (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() pri

Re: Writing a string.ishex function

2010-01-14 Thread MRAB
Duncan Booth wrote: MRAB 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 none of those

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 ")". -- http://mail.python.org/mailman/listinfo/py

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 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 missing perhaps

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 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 set(s)-set(string.hexdigits) > > But non

Re: Writing a string.ishex function

2010-01-14 Thread D'Arcy J.M. Cain
On Thu, 14 Jan 2010 18:36:12 + MRAB 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? There is only o

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

2010-01-14 Thread Aahz
In article , Robert Kern wrote: >On 2010-01-14 13:14 PM, Paul Rubin wrote: >> [email protected] (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 surpri

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

2010-01-14 Thread Aahz
In article <[email protected]>, Paul Rubin wrote: >[email protected] (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

Re: Writing a string.ishex function

2010-01-14 Thread exarkun
On 08:15 pm, [email protected] wrote: On 14 Jan 2010 19:19:53 GMT Duncan Booth 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 set(s)-set(strin

Re: Writing a string.ishex function

2010-01-14 Thread Arnaud Delobelle
MRAB writes: > Arnaud Delobelle wrote: >> "D'Arcy J.M. Cain" writes: >> >>> On Thu, 14 Jan 2010 09:07:47 -0800 >>> Chris Rebert 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. :-) >>> >>>

Re: Python and Tkinter Programming by John Grayson

2010-01-14 Thread Peter
On Jan 15, 6:24 am, Mark Roseman wrote: >  Peter 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 - wi

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

Re: Bare Excepts

2010-01-14 Thread Aahz
In article <[email protected]>, Steven D'Aprano 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 os.path.exists(fname): >> try:

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 r

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 Rebert 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) T

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 Roseman wrote: Peter 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 subs

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 m

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 abo

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 n

Re: Ignore leading '>>>' and ellipsis?

2010-01-14 Thread Rhodri James
On Thu, 14 Jan 2010 17:13:54 -, Reckoner 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 another interpr

Re: Writing a string.ishex function

2010-01-14 Thread MRAB
Arnaud Delobelle wrote: MRAB writes: Arnaud Delobelle wrote: "D'Arcy J.M. Cain" writes: On Thu, 14 Jan 2010 09:07:47 -0800 Chris Rebert 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 = lambd

[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 la

Re: Simple distributed example for learning purposes?

2010-01-14 Thread CM
On Dec 26 2009, 3:46 pm, Shawn Milochik 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. > However, it might be a

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,

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 the

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 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. Because it works be

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

2010-01-14 Thread Paul Boddie
On 28 Des 2009, 08:32, Andrew Jonathan Fine wrote: > >   As a hobby to keep me sane, I am attempting to retrain > part time at home as a jeweler and silversmith, and I sometimes used > Python for generating and manipulating code for CNC machines. It occurs to me that in some domains,

Re: Simple distributed example for learning purposes?

2010-01-14 Thread Ethan Furman
CM wrote: On Dec 26 2009, 3:46 pm, Shawn Milochik 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. However, it might

Re: Bare Excepts

2010-01-14 Thread [email protected]
On Jan 2, 9:35 pm, Dave Angel wrote: > Steven D'Aprano 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 os.path.exists(fname): > >>     try: > >>      

  1   2   >