Re: client-server parallellised number crunching

2011-04-26 Thread geremy condra
On Tue, Apr 26, 2011 at 10:58 PM, Hans Georg Schaathun wrote: > On Tue, 26 Apr 2011 14:31:59 -0700, geremy condra >   wrote: > :  Without knowledge of what you're doing it's hard to comment > :  intelligently, > > I need to calculate map( foobar, L ) where foobar() is a pure function > with no dep

recommended Emacs mode (was Re: Development tools and practices for Pythonistas)

2011-04-26 Thread Gour-Gadadhara Dasa
On Tue, 26 Apr 2011 07:39:41 -0700 (PDT) snorble wrote: > I'm not a Pythonista, but I aspire to be. > > My current tools: > > Python, gvim, OS file system I'm also starting with Python after abandoning idea to use D for our desktop GUI application. We plan to use Python + Qt along with Cython

Re: Terrible FPU performance

2011-04-26 Thread Ben Finney
Alec Taylor writes: > What's an FPU? Wikipedia not working for you today? :-) http://en.wikipedia.org/wiki/Floating-point_unit> I take it as a promising sign that computer-savvy people don't need to know the term anymore, since FPUs have long been integrated parts of the CPU on most computers.

Re: Python IDE/text-editor

2011-04-26 Thread Alec Taylor
Excellent news everyone! They've released an update for Editra with the bugfix for the issues I submitted. So now PyScripter and Editra do exactly what I need, but since Editra is updated it isn't buggy. =] Editra has tabs (in the right place!), syntax-highlight, shortcuts to run code, embedded

Re: client-server parallellised number crunching

2011-04-26 Thread Hans Georg Schaathun
On Tue, 26 Apr 2011 14:31:59 -0700, geremy condra wrote: : Without knowledge of what you're doing it's hard to comment : intelligently, I need to calculate map( foobar, L ) where foobar() is a pure function with no dependency on the global state, L is a list of tuples, each containing two

Re: Terrible FPU performance

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

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

2011-04-26 Thread alex23
rusi 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 the author of sqlite. -

Re: Terrible FPU performance

2011-04-26 Thread Chris Angelico
On Wed, Apr 27, 2011 at 3:11 PM, Alec Taylor 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 silicon, but used to be

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 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 David Cournapeau
On Wed, Apr 27, 2011 at 4:14 AM, Dan Goodman 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 denormal numbers: >

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

2011-04-26 Thread rusi
On Apr 27, 6:44 am, Tim Chase 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 present). > > Each of

Re: [OT] Comparing VCS tools

2011-04-26 Thread Ben Finney
Tim Chase 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) > - good cross-platfor

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 disadvantage

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

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: Case study: debugging failed assertRaises bug

2011-04-26 Thread Ben Finney
Steven D'Aprano 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 test failure which sounds exactly

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Ben Finney
Chris Angelico 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, Mercurial – are t

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

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 comment

Re: client-server parallellised number crunching

2011-04-26 Thread geremy condra
On Tue, Apr 26, 2011 at 12:55 PM, Hans Georg Schaathun 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 side to manage t

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: De-tupleizing a list

2011-04-26 Thread Raymond Hettinger
On Apr 25, 8:28 pm, Gnarlodious 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 1-tuple the sam

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: Case study: debugging failed assertRaises bug

2011-04-26 Thread Raymond Hettinger
On Apr 25, 11:05 pm, Steven D'Aprano 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 sure the lessons learned will be hel

Re: client-server parallellised number crunching

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

Re: De-tupleizing a list

2011-04-26 Thread Hans Georg Schaathun
On Tue, 26 Apr 2011 13:37:40 -0700, Ethan Furman 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 was in Python),

Re: Reading Huge UnixMailbox Files

2011-04-26 Thread Dan Stromberg
On Tue, Apr 26, 2011 at 1:23 PM, Nobody 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: Development tools and practices for Pythonistas

2011-04-26 Thread Dan Stromberg
On Tue, Apr 26, 2011 at 11:04 AM, Jean-Michel Pichavant 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). http://trac.edgewall.org/

Re: client-server parallellised number crunching

2011-04-26 Thread Hans Georg Schaathun
On Tue, Apr 26, 2011 at 1:20 PM, Chris Angelico 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 cannot afford the

Re: client-server parallellised number crunching

2011-04-26 Thread Chris Angelico
On Wed, Apr 27, 2011 at 6:33 AM, Dan Stromberg wrote: > On Tue, Apr 26, 2011 at 1:20 PM, Chris Angelico 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 b

Re: client-server parallellised number crunching

2011-04-26 Thread Dan Stromberg
On Tue, Apr 26, 2011 at 1:20 PM, Chris Angelico 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. ^_^ Here's that g

Re: client-server parallellised number crunching

2011-04-26 Thread Dan Stromberg
On Tue, Apr 26, 2011 at 12:55 PM, Hans Georg Schaathun 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 side to manage t

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~ -- http://mail.python.org/mailman/li

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 bu

Re: client-server parallellised number crunching

2011-04-26 Thread Chris Angelico
On Wed, Apr 27, 2011 at 5:55 AM, Hans Georg Schaathun 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 tasks from the

Re: Reading Huge UnixMailbox Files

2011-04-26 Thread Dan Stromberg
On Tue, Apr 26, 2011 at 12:39 PM, Brandon McGinty 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 mailbox module. > I create

Re: De-tupleizing a list

2011-04-26 Thread Hans Georg Schaathun
On Wed, 27 Apr 2011 04:30:01 +1000, Algis Kabaila 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 importantly, list comprehensio

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Chris Angelico
On Wed, Apr 27, 2011 at 12:39 AM, snorble 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 sync with todo.txt

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: De-tupleizing a list

2011-04-26 Thread Chris Angelico
On Wed, Apr 27, 2011 at 5:39 AM, Mark Niemczyk 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 only work with a t

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 += list(item

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 usi

Re: Restarting a daemon

2011-04-26 Thread Chris Angelico
On Tue, Apr 26, 2011 at 10:13 PM, 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

Re: Terrible FPU performance

2011-04-26 Thread Dan Stromberg
On Tue, Apr 26, 2011 at 6:40 AM, Mihai Badoiu 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 *= 0.8 >      

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 wrote: > > On Apr 26, 2011, at 1:34 PM, Mihai Badoiu wrote: > > > Already did. T

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: 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: 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 (i

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

Re: Development tools and practices for Pythonistas

2011-04-26 Thread CM
On Apr 26, 10:39 am, 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.,

Re: Simple map/reduce utility function for data analysis

2011-04-26 Thread Raymond Hettinger
On Apr 25, 7:42 pm, Paul Rubin wrote: > Raymond Hettinger 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 first draft had a defaultdict

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 g

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), an

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

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: 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: 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 wrote: > > > On Tue, Apr 26, 2011 at 8:40 AM, Mihai Badoiu wrote: > >> Hi, >> >> I have terrible

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 n

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 applying

Re: Terrible FPU performance

2011-04-26 Thread Chris Colbert
On Tue, Apr 26, 2011 at 8:40 AM, Mihai Badoiu 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. -- http://mail.python.org/m

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

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 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 "", line 1, in UnicodeDe

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 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') + cadena1.decode('u

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 "", line 1, in > UnicodeDecodeE

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 "", 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 Dan Stromberg
On Tue, Apr 26, 2011 at 8:58 AM, 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 "", line 1, in > UnicodeDecodeError:

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 expensive)(UML:

Re: How to concatenate unicode strings ???

2011-04-26 Thread Chris Rebert
On Tue, Apr 26, 2011 at 8:58 AM, 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 "", line 1, in > UnicodeDecodeError:

Re: Development tools and practices for Pythonistas

2011-04-26 Thread Martin P. Hellwig
On 26/04/2011 14:39, snorble wrote: 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 or start learnin

Re: Development tools and practices for Pythonistas

2011-04-26 Thread rusi
On Apr 26, 7:39 pm, snorble 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 > like, "I have probl

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 "", line 1, in UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 11: ordinal n

Re: Cannot get past this string related issue

2011-04-26 Thread Oltmans
On Apr 26, 7:39 pm, Thomas Rachel 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 = config.get("DB_INFO","database") > > use

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 s

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

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 paramet

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

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') server_in

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

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 userAccountC

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 l

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 pa

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: 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,)

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 sig

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 wrote: > > > Algis Kabaila writes: > > > > Are there any modules for vector algebra (three > > > > dimensional vectors, vector addition, subtraction, > > > > multiplication [scalar and vector]. Could you

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

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 PyObje

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 *self,

Re: Case study: debugging failed assertRaises bug

2011-04-26 Thread Duncan Booth
Steven D'Aprano 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 you are shown the Exception that

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 th

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-