Toronto Python Users' Group (PyGTA) meeting Wednesday 17th, 7:15pm

2009-06-09 Thread Mike C. Fletcher
This month (June 2009) we will be meeting on the 17th (a Wednesday, *not* our regular Tuesday). Linux Caffe is at the corner of Grace and Harbord streets, 1 block South of Christie subway station. This month's presentation is... Wednesday, June 17th: Behdad Esfahbod will be presenting on

Re: multi-core software

2009-06-09 Thread Piet van Oostrum
Seamus MacRae smacrae...@live.ca.invalid (SM) wrote: SM Piet van Oostrum wrote: By the way, there is a series of articles about concurrency on ACM Queue which may be interesting for those participating in or just following this discussion:

python version in snow leopard?

2009-06-09 Thread Alia Khouri
Does anyone know what version of python will appear in snow leopard which is apparently being released in September? -- http://mail.python.org/mailman/listinfo/python-list

Fwd: Extract value and average

2009-06-09 Thread Francesco Pietra
Sorry, I missed the last part of the message This makes a more generic parser (comment/uncomment the corresponding # 1 or # 2 code based on whether a new block is found by a first line containing NSTEP or a last line containing EWALD). This yields a dictionary for each item in the input file.

Re: Python preprosessor

2009-06-09 Thread Gabriel Genellina
En Sun, 07 Jun 2009 13:31:07 -0300, Tuomas Vesterinen tuomas.vesteri...@iki.fi escribió: I am developing a Python application as a Python2.x and Python3.0 version. A common code base would make the work easier. So I thought to try a preprosessor. GNU cpp handles this kind of code correct:

Function/method returning list of chars in string?

2009-06-09 Thread Hendrik van Rooyen
One can go from lb = ['b','a','n','a','n','a'] to s = banana by using s = .join(lb) Is there a way to go the reverse route? I have not been able to find one. It is obviously easy to write a for char in s loop or list comprehension, but there seems to be no function or string method to return a

Re: Function/method returning list of chars in string?

2009-06-09 Thread Chris Rebert
On Tue, Jun 9, 2009 at 12:25 AM, Hendrik van Rooyenm...@microcorp.co.za wrote: One can go from lb = ['b','a','n','a','n','a'] to s = banana by using s = .join(lb) Is there a way to go the reverse route? lb = list(banana) Cheers, Chris -- http://blog.rebertia.com --

Re: Function/method returning list of chars in string?

2009-06-09 Thread Diez B. Roggisch
Hendrik van Rooyen schrieb: One can go from lb = ['b','a','n','a','n','a'] to s = banana by using s = .join(lb) Is there a way to go the reverse route? I have not been able to find one. It is obviously easy to write a for char in s loop or list comprehension, but there seems to be no function

Re: Function/method returning list of chars in string?

2009-06-09 Thread jon vs. python
Sorry, I didn't realize that you already proposed list comprehension. There is some kind of asymmetry in several areas.I guess that's somehow related to this post: http://www.zedshaw.com/blog/2009-05-29.html http://www.zedshaw.com/blog/2009-05-29.html --

Re: python version in snow leopard?

2009-06-09 Thread Mark Dickinson
On Jun 9, 7:30 am, Alia Khouri alia_kho...@yahoo.com wrote: Does anyone know what version of python will appear in snow leopard which is apparently being released in September? The python-dev thread starting at http://mail.python.org/pipermail/python-3000/2008-September/014816.html suggests

Re: Extract value and average

2009-06-09 Thread Glauco
Francesco Pietra ha scritto: I come 'naked', which is unusual and unfair. However, I find it difficult to give a correct start. The files consist, among other things, of a huge number of blocks of the type NSTEP = 1000 TIME(PS) = 152.000 TEMP(K) = 298.54 PRESS =89.4 Etot

Re: Function/method returning list of chars in string?

2009-06-09 Thread John Machin
Hendrik van Rooyen mail at microcorp.co.za writes: One can go from lb = ['b','a','n','a','n','a'] to s = banana by using s = .join(lb) Is there a way to go the reverse route? | list('Hendrik') ['H', 'e', 'n', 'd', 'r', 'i', 'k'] Bonus extras: try tuple() and set() I have not been able

Re: preferring [] or () in list of error codes?

2009-06-09 Thread Steven D'Aprano
On Tue, 09 Jun 2009 09:43:45 +1000, Ben Finney wrote: Use a list when the semantic meaning of an item doesn't depend on all the other items: it's “only” a collection of values. Your list of message codes is a good example: if a value appears at index 3, that doesn't make it mean something

Re: Unbound Method Error

2009-06-09 Thread Piet van Oostrum
Enrico 4...@755189.45 (E) wrote: E lczancanella lczancane...@gmail.com ha scritto nel messaggio E news:32bf5ccb-5bfd-49a5-b423-9d41180a0...@l28g2000vba.googlegroups.com... Hi, i am brand new in Python, so sorry if this question is too basic, but i have tried a lot and dont have success... I

Start the interactive shell within an application

2009-06-09 Thread Jean-Michel Pichavant
I was wondering if there is a way to start an interactive shell within a script/application. I'm sometimes tired of adding prints to scan the current namespace so I'd like to pause the execution and give the user the shell prompt. This is obviously for debugging purpose. I know that I may use

Re: python version in snow leopard?

2009-06-09 Thread Alia K
Mark Dickinson wrote: The python-dev thread starting at http://mail.python.org/pipermail/python-3000/2008-September/014816.html suggests that back in September 2008, there was a 'MajorOS Vendor (tm)' who was interested in getting Python 2.6 into their next OS release, provided that it

Re: Start the interactive shell within an application

2009-06-09 Thread eGlyph
On Jun 9, 11:49 am, Jean-Michel Pichavant jeanmic...@sequans.com wrote: I'm sometimes tired of adding prints to scan the current namespace so I'd like to pause the execution and give the user the shell prompt. This is obviously for debugging purpose. This is definitely doable, have look at

Re: Start the interactive shell within an application

2009-06-09 Thread Javier Collado
Take a look either at code.interact or at IPython.ipapi.launch_new_instance. Basically, the only thing that you have to provide is a dictionary object that contains the namespace that you would like to have in your shell once it's launched. Best regards, Javier 2009/6/9 eGlyph

Re: Function/method returning list of chars in string?

2009-06-09 Thread Hendrik van Rooyen
jon vs. python wrote: Sorry, I didn't realize that you already proposed list comprehension. There is some kind of asymmetry in several areas.I guess that's somehow related to this post: http://www.zedshaw.com/blog/2009-05-29.html Thanks for the link - I am not quite as rabid, but it would

Re: SPAM-LOW: Re: Function/method returning list of chars in string?

2009-06-09 Thread Hendrik van Rooyen
Chris Rebert c...@ria.com wrote: lb = list(banana) Aaargh! I should have known - you use a string method to get a list of words, but you have to go to the list to get a list of characters from a string. There is no string method to do it, which is what I am complaining about. Is there a

Re: Function/method returning list of chars in string?

2009-06-09 Thread Hendrik van Rooyen
Diez B. Roggisch d...@nam.web.de wrote: I think lb = list(s) is good enough. It does the job, of course, but it is not a string method. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: SPAM-LOW: Re: Function/method returning list of chars in string?

2009-06-09 Thread Chris Rebert
On Tue, Jun 9, 2009 at 2:42 AM, Hendrik van Rooyenm...@microcorp.co.za wrote: Chris Rebert c...@ria.com wrote: lb = list(banana) Aaargh! I should have known - you use a string method to get a list of words, but you have to go to the list to get a list of characters from a string. There is

Re: Function/method returning list of chars in string?

2009-06-09 Thread Diez B. Roggisch
Hendrik van Rooyen wrote: Diez B. Roggisch d...@nam.web.de wrote: I think lb = list(s) is good enough. It does the job, of course, but it is not a string method. And that is a bad thing because of what? Also as list-comps are going away and are replaced by

Re: SPAM-LOW: Re: Function/method returning list of chars in string?

2009-06-09 Thread Marco Mariani
Hendrik van Rooyen wrote: lb = list(banana) Aaargh! I should have known - you use a string method to get a list of words, but you have to go to the list to get a list of characters from a string. As they say, Python is not Java. Strings support the sequence protocol (aka interface), hence

using libraries not installed on campus computers (numpy)

2009-06-09 Thread Chandramouli
I built and installed Numpy on my campus account, the install couldn't be done on the python install location. So I did it on my local storage location but I am clueless about how to use it I was expecting to see a numpy.py in the install dir so I could I suppose just give import path to install

Re: using libraries not installed on campus computers (numpy)

2009-06-09 Thread David Cournapeau
On Tue, Jun 9, 2009 at 7:40 PM, Chandramoulinaruvim...@gmail.com wrote: I built and installed Numpy on my campus account, the install couldn't be done on the python install location. So I did it on my local storage location but I am clueless about how to use it I was expecting to see a

Re: preferring [] or () in list of error codes?

2009-06-09 Thread samwyse
On Jun 8, 10:06 pm, Chris Rebert c...@rebertia.com wrote: On Mon, Jun 8, 2009 at 6:57 PM, samwysesamw...@gmail.com wrote: On Jun 8, 7:37 pm, Carl Banks pavlovevide...@gmail.com wrote: On Jun 8, 4:43 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: m...@pixar.com writes: Is there any

pywin32 - word object reference module - automating form filling

2009-06-09 Thread Brendan
I was hoping to use pywin32 to automate some rather tedious filling in of Word forms. I thought -- http://mail.python.org/mailman/listinfo/python-list

pywin32 - word object reference module - automating form filling

2009-06-09 Thread Brendan
I was hoping to use pywin32 to automate some rather tedious filling in of Word forms. I thought the process would be analogous to dealing with xml documents or DOM but find myself somewhat lost in the word object reference manual (http://msdn.microsoft.com/en-us/library/ bb244515.aspx) . I was

Re: preferring [] or () in list of error codes?

2009-06-09 Thread Ben Finney
Steven D'Aprano ste...@remove.this.cybersource.com.au writes: On Tue, 09 Jun 2009 09:43:45 +1000, Ben Finney wrote: Use a list when the semantic meaning of an item doesn't depend on all the other items: it's “only” a collection of values. Your list of message codes is a good example:

Re: Unbound Method Error

2009-06-09 Thread Enrico
lczancanella lczancane...@gmail.com ha scritto nel messaggio news:32bf5ccb-5bfd-49a5-b423-9d41180a0...@l28g2000vba.googlegroups.com... Hi, i am brand new in Python, so sorry if this question is too basic, but i have tried a lot and dont have success... I have the following code... class

Re: Unbound Method Error

2009-06-09 Thread Enrico
Piet van Oostrum p...@cs.uu.nl ha scritto nel messaggio news:m2ljo1ajnx@cs.uu.nl... The method doesn't need the class at all, so a staticmethod would be preferable: class Funcoes: @staticmethod def CifradorDeCesar(self, mensagem, chave, funcao): Yes, in this case self is not

Re: Unbound Method Error

2009-06-09 Thread Scott David Daniels
lczancanella wrote: Hi, i am brand new in Python, so sorry if this question is too basic, but i have tried a lot and dont have success... I have the following code... class Funcoes: def CifradorDeCesar(mensagem, chave, funcao): ... You've gotten some interesting advice. You want

Re: pywin32 - word object reference module - automating form filling

2009-06-09 Thread Brendan
On Jun 9, 9:54 am, Brendan brendandetra...@yahoo.com wrote: I was hoping to use pywin32 to automate some rather tedious filling in of Word forms. I thought the process would be analogous to dealing with xml documents or DOM but find myself somewhat lost in the word object reference manual

Re: preferring [] or () in list of error codes?

2009-06-09 Thread samwyse
On Jun 9, 12:30 am, Emile van Sebille em...@fenx.com wrote: On 6/8/2009 8:43 PM Ben Finney said... The fact that literal set syntax is a relative newcomer is the primary reason for that, I'd wager. Well, no.  It really is more, that's odd... why use set? Until I ran some timing tests this

Re: Function/method returning list of chars in string?

2009-06-09 Thread Carl Banks
On Jun 9, 2:47 am, Hendrik van Rooyen m...@microcorp.co.za wrote: Diez B. Roggisch d...@nam.web.de wrote: I think lb = list(s) is good enough. It does the job, of course, but it is not a string method. A. Your post's subject included the words function/method B. Who cares Carl

List comprehension and string conversion with formatting

2009-06-09 Thread stephen_b
I'd like to convert a list of floats to a list of strings constrained to one .1f format. These don't work. Is there a better way? [.1f % i for i in l] or [(.1f % i) for i in l] StephenB -- http://mail.python.org/mailman/listinfo/python-list

Re: List comprehension and string conversion with formatting

2009-06-09 Thread Carl Banks
On Jun 9, 8:38 am, stephen_b redplusbluemakespur...@gmail.com wrote: I'd like to convert a list of floats to a list of strings constrained to one .1f format. These don't work. Is there a better way? [.1f % i for i in l] or [(.1f % i) for i in l] You need a % in there, chief. [ %.1f % x for

Re: List comprehension and string conversion with formatting

2009-06-09 Thread Jaime Fernandez del Rio
On Tue, Jun 9, 2009 at 5:38 PM, stephen_bredplusbluemakespur...@gmail.com wrote: I'd like to convert a list of floats to a list of strings constrained to one .1f format. These don't work. Is there a better way? [.1f % i for i in l] or [(.1f % i) for i in l] There's a missing %, this does

Re: List comprehension and string conversion with formatting

2009-06-09 Thread stephen_b
On Jun 9, 10:43 am, Carl Banks pavlovevide...@gmail.com wrote: You need a % in there, chief. Carl Banks You are so right. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Using logging module to log into flash drive

2009-06-09 Thread kretel
Hi All, I am trying to implement the following functionality: 1. log messages to the flash drive 2. if the flash drive is not available, switch handler to the BufferringHandler and log into buffer, 3. once the flash drive is plugged in and available store the logs from BufferHandler into that

Re: Start the interactive shell within an application

2009-06-09 Thread Ben Charrow
If you're looking to debug your program, try import pdb and then wherever you want to debug put: pdb.set_trace() Your program will then enter the debugger when it executes that line. It's quite nice really. If you get confused on what to do, just type help

Re: preferring [] or () in list of error codes?

2009-06-09 Thread Carl Banks
On Jun 9, 4:57 am, samwyse samw...@gmail.com wrote: On Jun 8, 8:57 pm, samwyse samw...@gmail.com wrote: I conclude that using constructors is generally a bad idea, since the compiler doesn't know if you're calling the builtin or something with an overloaded name.  I presume that the

Re: preferring [] or () in list of error codes?

2009-06-09 Thread Carl Banks
On Jun 9, 8:20 am, samwyse samw...@gmail.com wrote: On Jun 9, 12:30 am, Emile van Sebille em...@fenx.com wrote: On 6/8/2009 8:43 PM Ben Finney said... The fact that literal set syntax is a relative newcomer is the primary reason for that, I'd wager. Well, no.  It really is more,

Re: preferring [] or () in list of error codes?

2009-06-09 Thread mh
John Machin sjmac...@lexicon.net wrote: T=lambda x:x in(25401,25402,25408);import dis;dis.dis(L);dis.dis(T) I've learned a lot from this thread, but this is the niftiest bit I've picked up... thanks! -- Mark Harrison Pixar Animation Studios --

Re: multi-thread python interpreaters and c++ program

2009-06-09 Thread Lie Ryan
myopc wrote: hi, all I am ruuning a c++ program (boost python) , which create many python interpreaters and each run a python script with use multi-thread (threading). when the c++ main program exit, I want to shut down python interpreaters, but it crashed. I have googled a lot but cant get

python and getopt and spaces in option

2009-06-09 Thread David Shapiro
Hello, I have been trying to find an example of how to deal with options that have spaces in them. I am using jython, which is the same I think as python 2.2.3. I feebly tried to use optparse and argparse with no success (got gettext, locale, and optparse). The code is as follows:

Re: Using logging module to log into flash drive

2009-06-09 Thread A. Cavallo
Hi, the problem screams for a separate thread. Anyway there's a TimedRotatingFileHandler handler in the logging package: you can derive from it and change the emit/doRollover pair to hold the records until a device is not ready. Regards, Antonio On Tuesday 09 June 2009 16:57:00 kretel

Re: Unbound Method Error

2009-06-09 Thread Chris Rebert
On Tue, Jun 9, 2009 at 8:19 AM, Scott David Danielsscott.dani...@acm.org wrote: lczancanella wrote: Hi, i am brand new in Python, so sorry if this question is too basic, but i have tried a lot and dont have success... I have the following code... class Funcoes:    def

Re: Using logging module to log into flash drive

2009-06-09 Thread Krzysztof Retel
On Jun 9, 6:10 pm, A. Cavallo a.cava...@mailsnare.com wrote: Hi, the problem screams for a separate thread. I was thinking about that, as mentioned in the first post. Although, I was wonder if there is another way to tackle the problem. Anyway there's a TimedRotatingFileHandler handler in

Re: multi-core software

2009-06-09 Thread toby
On Jun 7, 2:41 pm, Jon Harrop j...@ffconsultancy.com wrote: Arved Sandstrom wrote: Jon Harrop wrote: I see no problem with mutable shared state. In which case, Jon, you're in a small minority. No. Most programmers still care about performance Frequently when they shouldn't. and

Re: pylint naming conventions?

2009-06-09 Thread Esmail
R. David Murray wrote: Well, I for one looked at that long pylint output when I first tried it, and switched to another tool :) (pyflakes...but I don't think it does PEP 8) :-) Ok, so I'm not the only one who thinks the output is rather lengthy. I've since dug into the docs and searched on

Unbuffered keyboard input?

2009-06-09 Thread Ken D'Ambrosio
I need to have some non-buffered keyboard interaction with a Python script (on Linux). Back in the day, I fired up Curses to do this in Perl. Any idea if that's still how I have to fly? Or is there a different mechanism? Thanks! -Ken -- This message has been scanned for viruses and

Re: Unbound Method Error

2009-06-09 Thread Piet van Oostrum
Enrico 4...@755189.45 (E) wrote: E Piet van Oostrum p...@cs.uu.nl ha scritto nel messaggio E news:m2ljo1ajnx@cs.uu.nl... The method doesn't need the class at all, so a staticmethod would be preferable: class Funcoes: @staticmethod def CifradorDeCesar(self, mensagem, chave, funcao): E

Re: Using logging module to log into flash drive

2009-06-09 Thread Krzysztof Retel
Anyway there's a TimedRotatingFileHandler handler in the logging package: you can derive from it and change the emit/doRollover pair to hold the records until a device is not ready. Hm, that might be the way to go. Will have a try. I had another look at the logging package. The class

What is the actual type of interrupted system call?

2009-06-09 Thread mrstevegross
I'm trying to write a try/catch block to handle an interrupted system call. However, I can't seem to locate information on the actual typename of the exception. Does anyone know what it would be? I want my code to look like this: try: ... except InterruptedSystemCall # what's the right name?

Re: preferring [] or () in list of error codes?

2009-06-09 Thread Terry Reedy
Steven D'Aprano wrote: James Tauber explains this at URL:http://jtauber.com/blog/2006/04/15/ python_tuples_are_not_just_constant_lists/. He doesn't really explain anything though, he merely states it as revealed wisdom. The closest he comes to an explanation is to declare that in tuples

Re: Function/method returning list of chars in string?

2009-06-09 Thread Miles Kaufmann
On Jun 9, 2009, at 6:05 AM, Diez B. Roggisch wrote: Also as list-comps are going away and are replaced by list(generator-expression) Where did you hear that? -Miles -- http://mail.python.org/mailman/listinfo/python-list

Re: preferring [] or () in list of error codes?

2009-06-09 Thread Terry Reedy
m...@pixar.com wrote: John Machin sjmac...@lexicon.net wrote: T=lambda x:x in(25401,25402,25408);import dis;dis.dis(L);dis.dis(T) I've learned a lot from this thread, but this is the niftiest bit I've picked up... thanks! If you are doing a lot of dissing, starting with from dis import dis

spawning a process using os.spawn

2009-06-09 Thread rkmr...@gmail.com
hi im spawning a script that runs for a long from a web app like this: os.spawnle(os.P_NOWAIT, ../bin/producenotify.py, producenotify.py, xx,os.environ) the script is spawned and it runs, but till it gets over i am not able to free the port that is used by the web app, or in other words i am

Re: Unbuffered keyboard input?

2009-06-09 Thread Grant Edwards
On 2009-06-09, Ken D'Ambrosio k...@jots.org wrote: I need to have some non-buffered keyboard interaction with a Python script (on Linux). Back in the day, I fired up Curses to do this in Perl. Any idea if that's still how I have to fly? Or is there a different mechanism? Same as it ever

Re: Unbuffered keyboard input?

2009-06-09 Thread Jerry Hill
On Tue, Jun 9, 2009 at 1:52 PM, Ken D'Ambrosio k...@jots.org wrote: I need to have some non-buffered keyboard interaction with a Python script (on Linux). Assuming you're running your code from a command prompt, something like this recipe might do the trick:

Re: multi-core software

2009-06-09 Thread Jon Harrop
toby wrote: On Jun 7, 2:41 pm, Jon Harrop j...@ffconsultancy.com wrote: Arved Sandstrom wrote: Jon Harrop wrote: I see no problem with mutable shared state. In which case, Jon, you're in a small minority. No. Most programmers still care about performance Frequently when they

Re: Using logging module to log into flash drive

2009-06-09 Thread Carl Banks
On Jun 9, 8:57 am, kretel krzysztof.re...@googlemail.com wrote: Hi All, I am trying to implement the following functionality: 1. log messages to the flash drive 2. if the flash drive is not available, switch handler to the BufferringHandler and log into buffer, 3. once the flash drive is

Re: What is the actual type of interrupted system call?

2009-06-09 Thread mrstevegross
exceptions.EOFError exceptions.ReferenceError exceptions.ZeroDivisionError ... exceptions.NotImplementedError exceptions.UnicodeError exceptions.__str__ Is there a single parent exception to all those? Or should I just write it as: try: ... catch Exception: ... Thanks, --Steve --

Re: What is the actual type of interrupted system call?

2009-06-09 Thread Jean-Michel Pichavant
mrstevegross wrote: I'm trying to write a try/catch block to handle an interrupted system call. However, I can't seem to locate information on the actual typename of the exception. Does anyone know what it would be? I want my code to look like this: try: ... except InterruptedSystemCall #

Re: What is the actual type of interrupted system call?

2009-06-09 Thread Jeff McNeil
On Jun 9, 2:22 pm, mrstevegross mrstevegr...@gmail.com wrote: I'm trying to write a try/catch block to handle an interrupted system call. However, I can't seem to locate information on the actual typename of the exception. Does anyone know what it would be? I want my code to look like this:

csv.reader has trouble with comma inside quotes inside brackets

2009-06-09 Thread Bret
i have a csv file like so: row1,field1,[field2][text in field2 quote, quote],field3,field row2,field1,[field2]text in field2 quote, quote,field3,field using csv.reader to read the file, the first row is broken into two fields: [field2][text in field2 quote and quote while the second row is read

Re: Start the interactive shell within an application

2009-06-09 Thread Robert Kern
On 2009-06-09 03:49, Jean-Michel Pichavant wrote: I was wondering if there is a way to start an interactive shell within a script/application. I'm sometimes tired of adding prints to scan the current namespace so I'd like to pause the execution and give the user the shell prompt. This is

Re: What is the actual type of interrupted system call?

2009-06-09 Thread mrstevegross
That works for me.  There isn't an InterruptedSystemCall error or equivalent in the standard exception hierarchy.  EnvironmentError is the parent of OSError IOError, which is where you'll most likely be encountering that state. Thanks! --Steve --

Re: SPAM-LOW: Re: Function/method returning list of chars in string?

2009-06-09 Thread Terry Reedy
Hendrik van Rooyen wrote: I should have known - you use a string method to get a list of words, but you have to go to the list to get a list of characters from a string. That is symmetry. There is no string method to do it, which is what I am complaining about. That would be asymmetry.

Re: Function/method returning list of chars in string?

2009-06-09 Thread Terry Reedy
jon vs. python wrote: Sorry, I didn't realize that you already proposed list comprehension. There is some kind of asymmetry in several areas.I guess that's somehow related to this post: http://www.zedshaw.com/blog/2009-05-29.html The premise of this post by Zed the Insightful is that Python

setting program name, like $0= in perl?

2009-06-09 Thread mh
I'm sure this is a FAQ, but I certainly haven't been able to find an answer. Is it possible to set the program name as seen by the operating system or lower-level libraries? I'm connecting to a database, and the runtime helpfully sends some information to the server, such as username, pid, and

Re: multi-core software

2009-06-09 Thread George Neuner
On Tue, 9 Jun 2009 10:47:11 -0700 (PDT), toby t...@telegraphics.com.au wrote: On Jun 7, 2:41 pm, Jon Harrop j...@ffconsultancy.com wrote: Arved Sandstrom wrote: Jon Harrop wrote: performance means mutable state. Hm, not sure Erlangers would wholly agree. Erlang uses quite a bit of mutable

Re: Function/method returning list of chars in string?

2009-06-09 Thread Robert Kern
On 2009-06-09 14:43, Terry Reedy wrote: jon vs. python wrote: Sorry, I didn't realize that you already proposed list comprehension. There is some kind of asymmetry in several areas.I guess that's somehow related to this post: http://www.zedshaw.com/blog/2009-05-29.html The premise of this

Re: Function/method returning list of chars in string?

2009-06-09 Thread Terry Reedy
Miles Kaufmann wrote: On Jun 9, 2009, at 6:05 AM, Diez B. Roggisch wrote: Also as list-comps are going away and are replaced by list(generator-expression) Where did you hear that? Perhaps in the discussion of possible changes for 3.0 about 18 months ago. The idea was rejected because

Re: csv.reader has trouble with comma inside quotes inside brackets

2009-06-09 Thread John Machin
Bret bretrouse at gmail.com writes: i have a csv file like so: row1,field1,[field2][text in field2 quote, quote],field3,field row2,field1,[field2]text in field2 quote, quote,field3,field using csv.reader to read the file, the first row is broken into two fields: [field2][text in field2

Re: setting program name, like $0= in perl?

2009-06-09 Thread Emile van Sebille
On 6/9/2009 1:06 PM m...@pixar.com said... I'm sure this is a FAQ, but I certainly haven't been able to find an answer. Is it possible to set the program name as seen by the operating system or lower-level libraries? I'm connecting to a database, and the runtime helpfully sends some

Re: setting program name, like $0= in perl?

2009-06-09 Thread Daniel Fetchinson
I'm sure this is a FAQ, but I certainly haven't been able to find an answer. Is it possible to set the program name as seen by the operating system or lower-level libraries? I'm connecting to a database, and the runtime helpfully sends some information to the server, such as username,

Re: csv.reader has trouble with comma inside quotes inside brackets

2009-06-09 Thread Terry Reedy
Bret wrote: i have a csv file like so: row1,field1,[field2][text in field2 quote, quote],field3,field row2,field1,[field2]text in field2 quote, quote,field3,field using csv.reader to read the file, the first row is broken into two fields: [field2][text in field2 quote and quote while the

Re: csv.reader has trouble with comma inside quotes inside brackets

2009-06-09 Thread Bret
Thanks John, I didn't realize that the quotes were supposed to surround the entire field. I ended up making a quick script to replace comma's outside quotes with tabs. I was just trying to clean this crazy csv file to import into msyql. thanks again, bret --

Re: multi-core software

2009-06-09 Thread Dimiter malkia Stanev
Erlang uses quite a bit of mutable state behind the scenes ... the programmers just don't see it. George Heh... The CPUs use quite a bit of mutable state behind the scenes ... the programmers just don't see it. Actually with CPU they see it more, than... say Erlang (that's why you need to

random number including 1 - i.e. [0,1]

2009-06-09 Thread Esmail
Hi, random.random() will generate a random value in the range [0, 1). Is there an easy way to generate random values in the range [0, 1]? I.e., including 1? I am implementing an algorithm and want to stay as true to the original design specifications as possible though I suppose the difference

Re: Function/method returning list of chars in string?

2009-06-09 Thread Terry Reedy
Robert Kern wrote: On 2009-06-09 14:43, Terry Reedy wrote: jon vs. python wrote: Python and the stdlib is all open source. If he were to submit a patch, and it were ignored or rejected for whatever reason, he could still release it and register it on PyPI. I just checked and NONE of the 6710

Re: multi-core software

2009-06-09 Thread Emile van Sebille
On 6/9/2009 11:59 AM Jon Harrop said... toby wrote: On Jun 7, 2:41 pm, Jon Harrop j...@ffconsultancy.com wrote: snip No. Most programmers still care about performance Frequently when they shouldn't. I disagree. A lot of software is still far too slow because the programmers failed to pay

.pth files and figuring out valid paths..

2009-06-09 Thread rh0dium
I have a .pth file which has some logic in it - but it isn't quite enough... It started with this.. import os, site; site.addsitedir(os.path.join(os.environ[TECHROOT], tools/python/modules)) But that eventually evolved into.. import os, site; site.addsitedir(os.path.join(os.environ.get

Re: SPAM-LOW: Re: Function/method returning list of chars in string?

2009-06-09 Thread Carl Banks
On Jun 9, 12:42 pm, Terry Reedy tjre...@udel.edu wrote: Hendrik van Rooyen wrote: I should have known - you use a string method to get a list of words, but you have to go to the list to get a list of characters from a string. That is symmetry. There is no string method to do it, which is

Re: Function/method returning list of chars in string?

2009-06-09 Thread Robert Kern
On 2009-06-09 16:34, Terry Reedy wrote: Robert Kern wrote: On 2009-06-09 14:43, Terry Reedy wrote: jon vs. python wrote: Python and the stdlib is all open source. If he were to submit a patch, and it were ignored or rejected for whatever reason, he could still release it and register it on

Re: SPAM-LOW: Re: Function/method returning list of chars in string?

2009-06-09 Thread Robert Kern
On 2009-06-09 17:06, Carl Banks wrote: On Jun 9, 12:42 pm, Terry Reedytjre...@udel.edu wrote: Hendrik van Rooyen wrote: I should have known - you use a string method to get a list of words, but you have to go to the list to get a list of characters from a string. That is symmetry. There is

Re: .pth files and figuring out valid paths..

2009-06-09 Thread Emile van Sebille
On 6/9/2009 3:00 PM rh0dium said... I have a .pth file which has some logic in it - but it isn't quite enough... It started with this.. import os, site; site.addsitedir(os.path.join(os.environ[TECHROOT], tools/python/modules)) But that eventually evolved into.. import os, site;

Re: random number including 1 - i.e. [0,1]

2009-06-09 Thread Gabriel Genellina
En Tue, 09 Jun 2009 18:33:39 -0300, Esmail ebo...@hotmail.com escribió: random.random() will generate a random value in the range [0, 1). Is there an easy way to generate random values in the range [0, 1]? I.e., including 1? I think you shouldn't worry about that - the difference may be as

Re: random number including 1 - i.e. [0,1]

2009-06-09 Thread Mensanator
On Jun 9, 4:33 pm, Esmail ebo...@hotmail.com wrote: Hi, random.random() will generate a random value in the range [0, 1). Is there an easy way to generate random values in the range [0, 1]? I.e., including 1? I am implementing an algorithm and want to stay as true to the original design

Re: random number including 1 - i.e. [0,1]

2009-06-09 Thread Robert Kern
On 2009-06-09 18:05, Mensanator wrote: On Jun 9, 4:33 pm, Esmailebo...@hotmail.com wrote: Hi, random.random() will generate a random value in the range [0, 1). Is there an easy way to generate random values in the range [0, 1]? I.e., including 1? I am implementing an algorithm and want to

Re: random number including 1 - i.e. [0,1]

2009-06-09 Thread Miles Kaufmann
On Jun 9, 2009, at 7:05 PM, Mensanator wrote: On Jun 9, 4:33 pm, Esmail wrote: Hi, random.random() will generate a random value in the range [0, 1). Is there an easy way to generate random values in the range [0, 1]? I.e., including 1? I am implementing an algorithm and want to stay as true

Re: preferring [] or () in list of error codes?

2009-06-09 Thread Steven D'Aprano
On Tue, 09 Jun 2009 04:57:48 -0700, samwyse wrote: Time to test things! I'm going to compare three things using Python 3.0: X={...}\nS=lambda x: x in X S=lambda x: x in {...} S=lambda x: x in (...) where the ... is replaced by lists of integers of various lengths. Here's the test

Re: random number including 1 - i.e. [0,1]

2009-06-09 Thread Esmail
Gabriel Genellina wrote: En Tue, 09 Jun 2009 18:33:39 -0300, Esmail ebo...@hotmail.com escribió: random.random() will generate a random value in the range [0, 1). Is there an easy way to generate random values in the range [0, 1]? I.e., including 1? I think you shouldn't worry about that -

Re: random number including 1 - i.e. [0,1]

2009-06-09 Thread Esmail
Robert Kern wrote: On 2009-06-09 18:05, Mensanator wrote: On Jun 9, 4:33 pm, Esmailebo...@hotmail.com wrote: That's wrong. Where did you get it? http://docs.python.org/library/random What he said :-) (thanks Robert) -- http://mail.python.org/mailman/listinfo/python-list

Re: random number including 1 - i.e. [0,1]

2009-06-09 Thread Esmail
Miles Kaufmann wrote: I'm curious what algorithm calls for random numbers on a closed interval. I'm implementing a Particle Swarm Optimizer. Depending on what paper you read you'll see mention of required random values between 0 and 1 which is somewhat ambiguous. I came across one paper that

Re: .pth files and figuring out valid paths..

2009-06-09 Thread David Lyon
On Tue, 9 Jun 2009 16:30:06 -0700 (PDT), rh0dium steven.kl...@gmail.com wrote: Apparently there is a problem with the if statement??? Thanks No for .pth files this needs to be on a single line.. I can't really see why you need conditional code... If you want to add more locations...

Re: random number including 1 - i.e. [0,1]

2009-06-09 Thread Mensanator
On Jun 9, 6:12 pm, Robert Kern robert.k...@gmail.com wrote: On 2009-06-09 18:05, Mensanator wrote: On Jun 9, 4:33 pm, Esmailebo...@hotmail.com  wrote: Hi, random.random() will generate a random value in the range [0, 1). Is there an easy way to generate random values in the range

  1   2   >