[ANN] guiqwt v2.1.2

2011-04-26 Thread Pierre.RAYBAUT
Hi all, I am pleased to announce that `guiqwt` v2.1.2 has been released. This release mainly fixes a critical bug when running the GUI-based test launcher (except from the test launcher itself, this bug had absolutely no impact on the library -- it was however considered critical as many

[ANN] guidata v1.3.1

2011-04-26 Thread Pierre.RAYBAUT
Hi all, I am pleased to announce that `guidata` v1.3.1 has been released. Note that the project has recently been moved to GoogleCode: http://guidata.googlecode.com Main changes since `guidata` v1.3.0: * gettext_helpers module was not working on Linux * bugfixes The `guidata`

Case study: debugging failed assertRaises bug

2011-04-26 Thread Steven D'Aprano
I've just spent two hours banging my head against what I *thought* (wrongly!) was a spooky action-at-a-distance bug in unittest, so I thought I'd share it with anyone reading. I have a unit test which I inherit from a mixin class that looks something like this: def testBadArgType(self):

oauth 2 libraries.

2011-04-26 Thread David Vicente
Hi, I´m looking for a library to use oauth 2. I have found several libraries very similar among them. I´d like to know if someone use another one or some of these libraries and what do you advise me. - https://github.com/simplegeo/python-oauth2

Re: sockets: bind to external interface

2011-04-26 Thread Jean-Michel Pichavant
Hans Georg Schaathun wrote: Is there a simple way to find the external interface and bind a socket to it, when the hostname returned by socket.gethostname() maps to localhost? What seems to be the standard ubuntu configuration lists the local hostname with 127.0.0.1 in /etc/hosts. (I checked

Re: Case study: debugging failed assertRaises bug

2011-04-26 Thread Duncan Booth
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: (1) assertRaises REALLY needs a better error message. If not a custom message, at least it should show the result it got instead of an exception. If a different exception was thrown then you get an error instead of a failure and

Py_INCREF() incomprehension

2011-04-26 Thread Ervin Hegedüs
Hello Python users, I'm working on a Python module in C - that's a cryptographic module, which uses a 3rd-party lib from a provider (a bank). This module will encrypt and decrypt the messages for the provider web service. Here is a part of source: static PyObject* mycrypt_encrypt(PyObject

Re: Py_INCREF() incomprehension

2011-04-26 Thread Stefan Behnel
Ervin Hegedüs, 26.04.2011 11:48: Hello Python users, I'm working on a Python module in C - that's a cryptographic module, which uses a 3rd-party lib from a provider (a bank). This module will encrypt and decrypt the messages for the provider web service. Here is a part of source: static

Re: Py_INCREF() incomprehension

2011-04-26 Thread Hegedüs Ervin
Hello, thanks for the reply, static PyObject* mycrypt_encrypt(PyObject *self, PyObject *args) { int cRes = 0; int OutLen = 0; char * url; char * path; if (!PyArg_ParseTuple(args, ss,url,path)) { Use the s# format instead to get the length as well. oh,

Re: Py_INCREF() incomprehension

2011-04-26 Thread Hegedüs Ervin
hello, sorry for the typo, these are many cibcrypt reference, this is the real name of my module - I just replaced it somewhere to mycrypt - and somewhere I forgot... :( ... static PyObject *cibcrypt_error_badparm; ... void handle_err(int errcode) { switch(errcode) { ...

Re: Vectors

2011-04-26 Thread Algis Kabaila
On Monday 25 April 2011 20:49:34 Jonathan Hartley wrote: On Apr 20, 2:43 pm, Andreas Tawn andreas.t...@ubisoft.com wrote: Algis Kabaila akaba...@pcug.org.au writes: Are there any modules for vector algebra (three dimensional vectors, vector addition, subtraction, multiplication

Restarting a daemon

2011-04-26 Thread Jeffrey Barish
Not exactly a Python question, but I thought I would start here. I have a server that runs as a daemon. I can restart the server manually with the command myserver restart This command starts a new myserver which first looks up the pid for the one that is running and sends it a terminate

Re: De-tupleizing a list

2011-04-26 Thread Gnarlodious
On Apr 25, 10:59 pm, Steven D'Aprano wrote: In Python 3, map becomes lazy and returns an iterator instead of a list, so you have to wrap it in a call to list(). Ah, thanks for that tip. Also works for outputting a tuple: list_of_tuples=[('0A',), ('1B',), ('2C',), ('3D',)] #WRONG: (x for (x,)

Re: Py_INCREF() incomprehension

2011-04-26 Thread Thomas Rachel
Am 26.04.2011 14:21, schrieb Thomas Rachel: Especially look at the concepts called borrowed reference vs. owned reference. http://docs.python.org/extending/extending.html#reference-counting-in-python will be quite helpful. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Py_INCREF() incomprehension

2011-04-26 Thread Thomas Rachel
Am 26.04.2011 11:48, schrieb Ervin Hegedüs: Everything works fine, but sorry for the recurrent question: where should I use the Py_INCREF()/Py_DECREF() in code above? That depends on the functions which are called. It should be given in the API description. The same counts for the incoming

Re: Restarting a daemon

2011-04-26 Thread Albert Hopkins
On Tue, 2011-04-26 at 06:13 -0600, Jeffrey Barish wrote: Not exactly a Python question, but I thought I would start here. I have a server that runs as a daemon. I can restart the server manually with the command myserver restart This command starts a new myserver which first looks up

Active Directory user creation with python-ldap

2011-04-26 Thread Nello
I need to create an Active Directory user using python-ldap library. So, I authenticate with an admin account and I use add_s to create the user. Anyway, by default users are disabled on creation, and I can not set userAccountControl to swith off the flag ACCOUNTDISABLE, i.e. setting

Terrible FPU performance

2011-04-26 Thread Mihai Badoiu
Hi, I have terrible performance for multiplication when one number gets very close to zero. I'm using cython by writing the following code: cdef int i cdef double x = 1.0 for 0 = i 1000: x *= 0.8 #x += 0.01 print x This code runs much much slower (20+ times

Cannot get past this string related issue

2011-04-26 Thread Oltmans
Greetings, I hope you're doing well. I'm stuck in a strange issue, most likely due to my own ignorance. I'm reading a config file using ConfigParser module and passing database related info to _mssql. Following doesn't work config = ConfigParser.ConfigParser() config.read('configs.txt')

Re: Cannot get past this string related issue

2011-04-26 Thread Tim Golden
On 26/04/2011 14:48, Oltmans wrote: Greetings, I hope you're doing well. I'm stuck in a strange issue, most likely due to my own ignorance. I'm reading a config file using ConfigParser module and passing database related info to _mssql. [ ... ] Config file looks like following [DB_INFO]

Re: Py_INCREF() incomprehension

2011-04-26 Thread Hegedüs Ervin
Hello, thanks for the answer, Everything works fine, but sorry for the recurrent question: where should I use the Py_INCREF()/Py_DECREF() in code above? That depends on the functions which are called. It should be given in the API description. The same counts for the incoming parameters

Development tools and practices for Pythonistas

2011-04-26 Thread snorble
I'm not a Pythonista, but I aspire to be. My current tools: Python, gvim, OS file system My current practices: When I write a Python app, I have several unorganized scripts in a directory (usually with several named test1.py, test2.py, etc., from random ideas I have tested), and maybe a

Re: Cannot get past this string related issue

2011-04-26 Thread Thomas Rachel
Am 26.04.2011 15:48, schrieb Oltmans: Following doesn't work config = ConfigParser.ConfigParser() config.read('configs.txt') server_info = config.get(DB_INFO,server) db = config.get(DB_INFO,database) username = config.get(DB_INFO,user) pwd = config.get(DB_INFO,password) print

Re: Cannot get past this string related issue

2011-04-26 Thread Oltmans
On Apr 26, 7:39 pm, Thomas Rachel nutznetz-0c1b6768-bfa9-48d5- a470-7603bd3aa...@spamschutz.glglgl.de wrote: Am 26.04.2011 15:48, schrieb Oltmans: Following doesn't work config = ConfigParser.ConfigParser() config.read('configs.txt') server_info = config.get(DB_INFO,server) db

How to concatenate unicode strings ???

2011-04-26 Thread Ariel
Hi everybody, how could I concatenate unicode strings ??? What I want to do is this: unicode('this an example language ') + unicode('español') but I get an: Traceback (most recent call last): File console, line 1, in module UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position

Re: Development tools and practices for Pythonistas

2011-04-26 Thread rusi
On Apr 26, 7:39 pm, snorble snor...@hotmail.com wrote: I am aware of tools like version control systems, bug trackers, and things like these, but I'm not really sure if I need them, You either dont want version control But if I ever made something worth releasing, and got a request

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Martin P. Hellwig
On 26/04/2011 14:39, snorble wrote: cut explanation I would strongly advice to get familiar with: - Lint tools (like PyLint) - Refactoring - Source Control Systems (like Mercurial Hg) - Unit Testing with Code Coverage Followed by either writing your own toolset that integrates all of the above

Re: How to concatenate unicode strings ???

2011-04-26 Thread Chris Rebert
On Tue, Apr 26, 2011 at 8:58 AM, Ariel isaacr...@gmail.com wrote: Hi everybody, how could I concatenate unicode strings ??? What I want to do is this: unicode('this an example language ') + unicode('español') but I get an: Traceback (most recent call last):   File console, line 1, in

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Jayme Proni Filho
That's my Notebook/PC configuration and I'm user of Gentoo and Slackware. * vi (not vim) for C/C++ * Eclipse for Java * Wing IDE Professional (Python Editor); * Django: Best framework for while in my opinion; * tkinter, GTK and Qt; * MySQL, PostgreSQL ; * Rational Rose Modeler (very

Re: How to concatenate unicode strings ???

2011-04-26 Thread Dan Stromberg
On Tue, Apr 26, 2011 at 8:58 AM, Ariel isaacr...@gmail.com wrote: Hi everybody, how could I concatenate unicode strings ??? What I want to do is this: unicode('this an example language ') + unicode('español') but I get an: Traceback (most recent call last):   File console, line 1, in

Re: Py_INCREF() incomprehension

2011-04-26 Thread Thomas Rachel
Am 26.04.2011 16:03, schrieb Hegedüs Ervin: I've read API doc (which you've included in another mail), but that's not clear for me. :( No probem, I'll go in detail, now as I have read it again. (I didn't want to help from memory, as it is some time ago I worked with it, and didn't have time

Re: How to concatenate unicode strings ???

2011-04-26 Thread Ariel
And what about if after the string is concat I want it to pass is to the command line to do anything else, for instance: one_command = cadena.decode('utf-8') + cadena1.decode('utf-8') commands.getoutput(one_comand) But I receive this error: Traceback (most recent call last): File console, line

Re: How to concatenate unicode strings ???

2011-04-26 Thread Albert Hopkins
On Tue, 2011-04-26 at 17:58 +0200, Ariel wrote: Hi everybody, how could I concatenate unicode strings ??? What I want to do is this: unicode('this an example language ') + unicode('español') but I get an: Traceback (most recent call last): File console, line 1, in module

Re: How to concatenate unicode strings ???

2011-04-26 Thread Ariel
with commands.getoutput(one_comand.encode('utf-8')) it works !!! On Tue, Apr 26, 2011 at 6:22 PM, Ariel isaacr...@gmail.com wrote: And what about if after the string is concat I want it to pass is to the command line to do anything else, for instance: one_command = cadena.decode('utf-8') +

Re: How to concatenate unicode strings ???

2011-04-26 Thread Jean-Michel Pichavant
Chris Rebert wrote: On Tue, Apr 26, 2011 at 8:58 AM, Ariel isaacr...@gmail.com wrote: Hi everybody, how could I concatenate unicode strings ??? What I want to do is this: unicode('this an example language ') + unicode('español') but I get an: Traceback (most recent call last): File

Re: How to concatenate unicode strings ???

2011-04-26 Thread Terry Reedy
On 4/26/2011 12:07 PM, Chris Rebert wrote: On Tue, Apr 26, 2011 at 8:58 AM, Arielisaacr...@gmail.com wrote: Hi everybody, how could I concatenate unicode strings ??? What I want to do is this: unicode('this an example language ') + unicode('español') but I get an: Traceback (most recent call

Re: Terrible FPU performance

2011-04-26 Thread Chris Colbert
On Tue, Apr 26, 2011 at 8:40 AM, Mihai Badoiu mbad...@gmail.com wrote: Hi, I have terrible performance for multiplication when one number gets very close to zero. I'm using cython by writing the following code: You should ask this question on the Cython users mailing list. --

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Jayme Proni Filho
When I said to studying two kind of Version Control. It is because I don't know if you are already working with prgramming. So I think it is very important you know how to work both ways of version control system. You don't need to install both. Just read about one and work with other. For

Re: Py_INCREF() incomprehension

2011-04-26 Thread Hegedüs Ervin
Dear Thomas, thank you again, The ownership rules say that the input parameter belongs to the caller who holds it at least until we return. (We just borrow it.) So no action needed. ok, its' clear, I understand, * Py_BuildValue() This function transfers ownership, as it is none of

Re: Terrible FPU performance

2011-04-26 Thread Mihai Badoiu
Already did. They suggested the python list, because the asm generated code is really correct and the problem might be with the python running on top. On Tue, Apr 26, 2011 at 1:04 PM, Chris Colbert sccolb...@gmail.com wrote: On Tue, Apr 26, 2011 at 8:40 AM, Mihai Badoiu mbad...@gmail.com

Re: Terrible FPU performance

2011-04-26 Thread Philip Semanchuk
On Apr 26, 2011, at 1:34 PM, Mihai Badoiu wrote: Already did. They suggested the python list, because the asm generated code is really correct and the problem might be with the python running on top. Does the same timing in consistency appear when you use pure Python? bye Philip On

Re: Py_INCREF() incomprehension

2011-04-26 Thread Thomas Rachel
Am 26.04.2011 19:28, schrieb Hegedüs Ervin: Another question: here is an another part ot my code: static PyObject* mycrypt_decrypt(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, ss,data,path)) { return NULL; } ... } When I call this function from Python

Re: How to concatenate unicode strings ???

2011-04-26 Thread Algis Kabaila
On Wednesday 27 April 2011 02:33:00 Ariel wrote: with commands.getoutput(one_comand.encode('utf-8')) it works !!! On Tue, Apr 26, 2011 at 6:22 PM, Ariel isaacr...@gmail.com wrote: And what about if after the string is concat I want it to pass is to the command line to do anything else,

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Jean-Michel Pichavant
snorble wrote: I'm not a Pythonista, but I aspire to be. My current tools: Python, gvim, OS file system My current practices: When I write a Python app, I have several unorganized scripts in a directory (usually with several named test1.py, test2.py, etc., from random ideas I have tested),

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Thomas Rachel
Am 26.04.2011 16:39, schrieb snorble: When I write a Python app, I have several unorganized scripts in a directory (usually with several named test1.py, test2.py, etc., from random ideas I have tested), and maybe a todo.txt file. Then I hack away, adding features in a semi-random order. Then I

Re: Simple map/reduce utility function for data analysis

2011-04-26 Thread Raymond Hettinger
On Apr 25, 7:42 pm, Paul Rubin no.em...@nospam.invalid wrote: Raymond Hettinger pyt...@rcn.com writes: Here's a handy utility function for you guys to play with:    http://code.activestate.com/recipes/577676/ Cute, but why not use collections.defaultdict for the return dict? Untested: My

Re: Development tools and practices for Pythonistas

2011-04-26 Thread CM
On Apr 26, 10:39 am, snorble snor...@hotmail.com wrote: I'm not a Pythonista, but I aspire to be. My current tools: Python, gvim, OS file system My current practices: When I write a Python app, I have several unorganized scripts in a directory (usually with several named test1.py,

Re: De-tupleizing a list

2011-04-26 Thread Algis Kabaila
On Tuesday 26 April 2011 22:19:08 Gnarlodious wrote: On Apr 25, 10:59 pm, Steven D'Aprano wrote: In Python 3, map becomes lazy and returns an iterator instead of a list, so you have to wrap it in a call to list(). Ah, thanks for that tip. Also works for outputting a tuple:

Re: Development tools and practices for Pythonistas

2011-04-26 Thread CM
I guess it depends on your project, but that sounds needlessly complex and way too tough with a VCS.  I'd say just don't go there. (Whoops, I meant way too tough *without* a VCS, not with) -- http://mail.python.org/mailman/listinfo/python-list

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Algis Kabaila
On Wednesday 27 April 2011 03:59:25 Thomas Rachel wrote: Am 26.04.2011 16:39, schrieb snorble: When I write a Python app, I have several unorganized I don't see how these tools will help to get up to date the way you describe it - but all other issues are well coped with using a VCS. I

Re: Py_INCREF() incomprehension

2011-04-26 Thread Hegedüs Ervin
Hello, But, when I don't read input arguments (there isn't PyArg_ParseTuple), there isn't exception. How Python handle the number of arguments? From what you tell it: with PyArg_ParseTuple(). (see http://docs.python.org/c-api/arg.html for this). You give a format string (in your case:

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Algis Kabaila
On Wednesday 27 April 2011 04:31:19 CM wrote: I guess it depends on your project, but that sounds needlessly complex and way too tough with a VCS. I'd say just don't go there. (Whoops, I meant way too tough *without* a VCS, not with) And read your own emails *before* sending them :)

Re: Terrible FPU performance

2011-04-26 Thread Dan Goodman
Hi, On 26/04/2011 15:40, Mihai Badoiu wrote: I have terrible performance for multiplication when one number gets very close to zero. I'm using cython by writing the following code: This might be an issue with denormal numbers: http://en.wikipedia.org/wiki/Denormal_number I don't know much

Re: Terrible FPU performance

2011-04-26 Thread Mihai Badoiu
Yes, running on pure python has the same issue (but overall only a factor 3 away): i = 0 x = 1.0 while i 1000: x *= 0.8 #x += 0.01 i += 1 print x On Tue, Apr 26, 2011 at 1:44 PM, Philip Semanchuk phi...@semanchuk.comwrote: On Apr 26, 2011, at 1:34 PM, Mihai Badoiu wrote:

Re: Terrible FPU performance

2011-04-26 Thread Dan Stromberg
On Tue, Apr 26, 2011 at 6:40 AM, Mihai Badoiu mbad...@gmail.com wrote: Hi, I have terrible performance for multiplication when one number gets very close to zero.  I'm using cython by writing the following code:     cdef int i     cdef double x = 1.0     for 0 = i 1000:         x *=

Re: Restarting a daemon

2011-04-26 Thread Chris Angelico
On Tue, Apr 26, 2011 at 10:13 PM, Jeffrey Barish jeff_bar...@earthlink.net wrote: Not exactly a Python question, but I thought I would start here. I have a server that runs as a daemon.  I can restart the server manually with the command myserver restart This command starts a new myserver

Reading Huge UnixMailbox Files

2011-04-26 Thread Brandon McGinty
List, I'm trying to import hundreds of thousands of e-mail messages into a database with Python. However, some of these mailboxes are so large that they are giving errors when being read with the standard mailbox module. I created a buffered reader, that reads chunks of the mailbox, splits them

Re: De-tupleizing a list

2011-04-26 Thread Mark Niemczyk
Some interesting performance comparisons, under Python 3.2. Times are relative, and are for an initial list of tuples with 500,000 items. (1)ans = [] #relative time: 298 for item in lst: ans +=

Re: De-tupleizing a list

2011-04-26 Thread Chris Angelico
On Wed, Apr 27, 2011 at 5:39 AM, Mark Niemczyk praham...@gmail.com wrote: (2)    return [item[0] for item in lst]                          #relative time:  106 (5)    return [x for (x,) in lst]                                       #relative time:  52 Interesting indeed. #5 will of course

client-server parallellised number crunching

2011-04-26 Thread Hans Georg Schaathun
I wonder if anyone has any experience with this ... I try to set up a simple client-server system to do some number crunching, using a simple ad hoc protocol over TCP/IP. I use two Queue objects on the server side to manage the input and the output of the client process. A basic system running

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Chris Angelico
On Wed, Apr 27, 2011 at 12:39 AM, snorble snor...@hotmail.com wrote: When I write a Python app, I have several unorganized scripts in a directory (usually with several named test1.py, test2.py, etc., from random ideas I have tested), and maybe a todo.txt file. ... The code is usually out of

Re: De-tupleizing a list

2011-04-26 Thread Hans Georg Schaathun
On Wed, 27 Apr 2011 04:30:01 +1000, Algis Kabaila akaba...@pcug.org.au wrote: : I would prefer that to using a ready made module, as it would : be quicker than learning about the module, OTH, learning about : a module may be useful for other problems. A standard dilema... More

Re: Reading Huge UnixMailbox Files

2011-04-26 Thread Dan Stromberg
On Tue, Apr 26, 2011 at 12:39 PM, Brandon McGinty brandon.mcgi...@gmail.com wrote: List, I'm trying to import hundreds of thousands of e-mail messages into a database with Python. However, some of these mailboxes are so large that they are giving errors when being read with the standard

Re: client-server parallellised number crunching

2011-04-26 Thread Chris Angelico
On Wed, Apr 27, 2011 at 5:55 AM, Hans Georg Schaathun ge...@schaathun.net wrote: It is, of course, possible for the master thread upon processing the results, to requeue the tasks for any missing results, but it seems to me to be a cleaner solution if I could detect disconnects and requeue the

Re: Reading Huge UnixMailbox Files

2011-04-26 Thread Nobody
On Tue, 26 Apr 2011 15:39:37 -0400, Brandon McGinty wrote: I'm trying to import hundreds of thousands of e-mail messages into a database with Python. However, some of these mailboxes are so large that they are giving errors when being read with the standard mailbox module. I created a

Re: De-tupleizing a list

2011-04-26 Thread Ethan Furman
Hans Georg Schaathun wrote: List comprehension is understood even by readers with no experience with python. There's nothing magically understandable about a list comp -- the first time I saw one (which was in Python), I had to learn about them. ~Ethan~ --

Re: client-server parallellised number crunching

2011-04-26 Thread Dan Stromberg
On Tue, Apr 26, 2011 at 12:55 PM, Hans Georg Schaathun ge...@schaathun.net wrote: I wonder if anyone has any experience with this ... I try to set up a simple client-server system to do some number crunching, using a simple ad hoc protocol over TCP/IP.  I use two Queue objects on the server

Re: client-server parallellised number crunching

2011-04-26 Thread Dan Stromberg
On Tue, Apr 26, 2011 at 1:20 PM, Chris Angelico ros...@gmail.com wrote: But question: Why are you doing major number crunching in Python? On your quad-core machine, recode in C and see if you can do the whole job without bothering the unreliable boxen at all. Hmm, or try Cython or PyPy. ^_^

Re: client-server parallellised number crunching

2011-04-26 Thread Chris Angelico
On Wed, Apr 27, 2011 at 6:33 AM, Dan Stromberg drsali...@gmail.com wrote: On Tue, Apr 26, 2011 at 1:20 PM, Chris Angelico ros...@gmail.com wrote: But question: Why are you doing major number crunching in Python? On your quad-core machine, recode in C and see if you can do the whole job

Re: client-server parallellised number crunching

2011-04-26 Thread Hans Georg Schaathun
On Tue, Apr 26, 2011 at 1:20 PM, Chris Angelico ros...@gmail.com wrote: But question: Why are you doing major number crunching in Python? On your quad-core machine, recode in C and see if you can do the whole job without bothering the unreliable boxen at all. The reason is very simple. I

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Dan Stromberg
On Tue, Apr 26, 2011 at 11:04 AM, Jean-Michel Pichavant jeanmic...@sequans.com wrote: You can have a look at SVN and bugzilla, they are free SCM bug tracker applications. Make sure it's worth the pain though, these tools are not that easy to administrate (the usage is pretty simple).

Re: Reading Huge UnixMailbox Files

2011-04-26 Thread Dan Stromberg
On Tue, Apr 26, 2011 at 1:23 PM, Nobody nob...@nowhere.com wrote: E.g. the following script reads a mailbox on stdin and writes a separate file for each message:        #!/usr/bin/awk -f        BEGIN {                num = 0;                ofile = ;        }        /^From / {          

Re: De-tupleizing a list

2011-04-26 Thread Hans Georg Schaathun
On Tue, 26 Apr 2011 13:37:40 -0700, Ethan Furman et...@stoneleaf.us wrote: : Hans Georg Schaathun wrote: : List comprehension is understood even by readers with no experience : with python. : : There's nothing magically understandable about a list comp -- the first : time I saw one (which

Re: client-server parallellised number crunching

2011-04-26 Thread Chris Angelico
On Wed, Apr 27, 2011 at 6:47 AM, Hans Georg Schaathun h...@schaathun.net wrote: Does that answer your question, Chris? Yup! It does. :) Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

Re: Case study: debugging failed assertRaises bug

2011-04-26 Thread Raymond Hettinger
On Apr 25, 11:05 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: I've just spent two hours banging my head against what I *thought* (wrongly!) was a spooky action-at-a-distance bug in unittest, so I thought I'd share it with anyone reading. Thanks for telling your story. I'm

2.X functools.update_wrapper dislikes missing function attributes

2011-04-26 Thread samwyse
I noticed a behavior in Jython 2.5.2 that's arguably an implementation bug, but I'm wondering if it's something to be fixed for all versions of Python. I was wanting to decorate a Java instance method, and discovered that it didn't have a __module__ attribute. This caused the following message:

Re: De-tupleizing a list

2011-04-26 Thread Raymond Hettinger
On Apr 25, 8:28 pm, Gnarlodious gnarlodi...@gmail.com wrote: I have an SQLite query that returns a list of tuples: [('0A',), ('1B',), ('2C',), ('3D',),... What is the most Pythonic way to loop through the list returning a list like this?: ['0A', '1B', '2C', '3D',... You could unpack the

Re: 2.X functools.update_wrapper dislikes missing function attributes

2011-04-26 Thread samwyse
I just noticed an old issue that relate to this: http://bugs.python.org/issue3445 This dates back to 2008 and is marked as fixed, but my copies of Python 2.5.4 and 2.7.1 don't seem to implement it. I'll try to dig further. -- http://mail.python.org/mailman/listinfo/python-list

Re: client-server parallellised number crunching

2011-04-26 Thread geremy condra
On Tue, Apr 26, 2011 at 12:55 PM, Hans Georg Schaathun ge...@schaathun.net wrote: I wonder if anyone has any experience with this ... I try to set up a simple client-server system to do some number crunching, using a simple ad hoc protocol over TCP/IP.  I use two Queue objects on the server

Re: Terrible FPU performance

2011-04-26 Thread Terry Reedy
On 4/26/2011 3:27 PM, Dan Stromberg wrote: for 0= i 1000: x *= 0.8 #x += 0.01 print x In my WinXP (Athlon), 3.2 standard install x=1.0 print(x) for i in range(1000): x *= 0.8 x += 0.01 print(x) takes about 3 1/2 secs with addition

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Thomas Rachel
Am 26.04.2011 20:42, schrieb Algis Kabaila: Thomas, have you tried bzr (Bazaar) and if so do you consider hg (Mercurial) better? I have played around with bzr, but afterwards more with hg which gave me a better beeling (don't know why)... Thomas --

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Ben Finney
Chris Angelico ros...@gmail.com writes: As other people have said, version control is very handy. I use git myself, but imho the choice of _which_ VCS you use is far less important than the choice of _whether_ to use one. True enough. But the modern crop of first-tier VCSen – Bazaar, Git,

Re: Case study: debugging failed assertRaises bug

2011-04-26 Thread Ben Finney
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: I've just spent two hours banging my head against what I *thought* (wrongly!) was a spooky action-at-a-distance bug in unittest, so I thought I'd share it with anyone reading. Much appreciated. I am experiencing a tear-my-hair-out

Automatic placement of a text box? ie empty legend [matplotlib]

2011-04-26 Thread C Barrington-Leigh
The automatic placement functionality of legend() is nice. I'd like to make use of it to place a box with just a title or title and comment (ie, some text) but no lines or legend entries. Does anyone know a way to do this? -- http://mail.python.org/mailman/listinfo/python-list

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Algis Kabaila
On Wednesday 27 April 2011 09:41:53 Ben Finney wrote: Chris Angelico ros...@gmail.com writes: As other people have said, version control is very handy. I use git myself, but imho the choice of _which_ VCS you use is far less important than the choice of _whether_ to use one. True

Re: [OT] Comparing VCS tools (was Development tools and practices for Pythonistas)

2011-04-26 Thread Tim Chase
On 04/26/2011 01:42 PM, Algis Kabaila wrote: Thomas, have you tried bzr (Bazaar) and if so do you consider hg (Mercurial) better? And why is it better? (bzr is widely used in ubuntu, which is my favourite distro at present). Each of the main 3 (bzr, hg, git) have advantages and

Re: [OT] Comparing VCS tools

2011-04-26 Thread Ben Finney
Tim Chase python.l...@tim.thechases.com writes: Bazaar (bzr) launchpad.net popular for hosting Pros: - some Ubuntu interactions (such as launchpad) easier - a rigorous focus on correctness - written in Python (with a small optional bit of C) - easy-to-use interface (CVS-ish)

Re: Comparing VCS tools (was Development tools and practices for Pythonistas)

2011-04-26 Thread rusi
On Apr 27, 6:44 am, Tim Chase python.l...@tim.thechases.com wrote: On 04/26/2011 01:42 PM, Algis Kabaila wrote: Thomas, have you tried bzr (Bazaar) and if so do you consider hg (Mercurial) better? And why is it better?   (bzr is widely used in ubuntu, which is my favourite distro at

Re: Terrible FPU performance

2011-04-26 Thread David Cournapeau
On Wed, Apr 27, 2011 at 4:14 AM, Dan Goodman dg.gm...@thesamovar.net wrote: Hi, On 26/04/2011 15:40, Mihai Badoiu wrote: I have terrible performance for multiplication when one number gets very close to zero.  I'm using cython by writing the following code: This might be an issue with

Re: Terrible FPU performance

2011-04-26 Thread Alec Taylor
What's an FPU? On Tue, Apr 26, 2011 at 11:40 PM, Mihai Badoiu mbad...@gmail.com wrote: Hi, I have terrible performance for multiplication when one number gets very close to zero.  I'm using cython by writing the following code:     cdef int i     cdef double x = 1.0     for 0 = i 1000:

Re: Terrible FPU performance

2011-04-26 Thread Chris Angelico
On Wed, Apr 27, 2011 at 3:11 PM, Alec Taylor alec.tayl...@gmail.com wrote: What's an FPU? Floating Point Unit, the part of your computer's processor that handles floating-point mathematics. Integer calculations are done in the main CPU, but the FPU (which these days is part of the same hunk of

Re: Comparing VCS tools (was Development tools and practices for Pythonistas)

2011-04-26 Thread alex23
rusi rustompm...@gmail.com wrote: What's the facts? Anyone with any experiences on this? No experience, but I'm rather torn over Fossil. On the one hand, it feels like NIH writ large; on the other hand, it's a DVCS with Trac- like features in a standalone executable less than 1MB in size...by

Re: Terrible FPU performance

2011-04-26 Thread rusi
On Apr 27, 10:11 am, Alec Taylor alec.tayl...@gmail.com wrote: What's an FPU? http://lmgtfy.com/?q=fpu -- http://mail.python.org/mailman/listinfo/python-list

[issue11682] PEP 380 reference implementation for 3.3

2011-04-26 Thread Yury Selivanov
Changes by Yury Selivanov yseliva...@gmail.com: -- nosy: +Yury.Selivanov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11682 ___ ___

[issue11918] Drop OS/2 and VMS support in Python 3.3

2011-04-26 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org added the comment: I wrote to the maintainer of vmspython, and he said this: Python on VMS is actively maintained, for example you can take a look at http://www.vmspython.org/ and http://www.vmspython.org/History Our plan are to port, this year 2.7, then

[issue11918] Drop OS/2 and VMS support in Python 3.3

2011-04-26 Thread Piéronne Jean-François
Piéronne Jean-François piero...@users.sourceforge.net added the comment: How can we help you ? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11918 ___

[issue10517] test_concurrent_futures crashes with --with-pydebug on RHEL5 with Fatal Python error: Invalid thread state for this thread

2011-04-26 Thread Charles-Francois Natali
Charles-Francois Natali neolo...@free.fr added the comment: Not necessarily. You can have several interpreters (and therefore several thread states) in a single thread, using Py_NewInterpreter(). It's used by mod_wsgi and probably other software. If you overwrite the old value with the

[issue11918] Drop OS/2 and VMS support in Python 3.3

2011-04-26 Thread Jesús Cea Avión
Jesús Cea Avión j...@jcea.es added the comment: Would be possible to publish a notice in python insider blog?.Enigmail -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11918 ___

[issue10154] locale.normalize strips - from UTF-8, which fails on Mac

2011-04-26 Thread Marc-Andre Lemburg
Marc-Andre Lemburg m...@egenix.com added the comment: Piotr Sikora wrote: Piotr Sikora piotr.sik...@frickle.com added the comment: It's the same on OpenBSD (and I'm pretty sure it's true for other BSDs as well). locale.resetlocale() Traceback (most recent call last): File stdin,

[issue9390] Error in sys.excepthook on windows when redirecting output of the script

2011-04-26 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: This post: http://stackoverflow.com/questions/3018848/cannot-run-python-script-on-windows-with-output-redirected suggests that there is a difference between python test.py out.log and test.py out.log. It also suggests a change in the

  1   2   >