Re: Modifying Class Object

2010-02-11 Thread Steven D'Aprano
On Thu, 11 Feb 2010 17:11:17 -0500, Terry Reedy wrote: > About 13 years ago, I noticed that electronically executable Python was > very similar to some of the designed-for-human-reading algoritm > languages (pseudocode) that were not. I then coined the oxymoron > 'executable pseudocode' for Python

Re: python crash on windows but not on linux

2010-02-11 Thread hjebbers
On Feb 12, 12:13 am, Emile van Sebille wrote: > On 2/11/2010 6:32 AM hjebbers said... > > > To all, > > I am running an EDI translator, > > ... let's say bots  :) > > > and doing stress tests. > > When processing a test with a (relatively) big EDI file(s) on > > windowsXP  I get a crash: > >      

Re: Modifying Class Object

2010-02-11 Thread Steven D'Aprano
On Thu, 11 Feb 2010 23:26:34 +0100, Alf P. Steinbach wrote: >> I presume you agree that the name 'Alf P. Steinbach' refers to you. Do >> you then consider it to be a 'reference' to you? > > Yes, and that's irrelevant, because you can't change a name. Pardon me, but you most certainly can. Even G

Re: Modifying Class Object

2010-02-11 Thread Alf P. Steinbach
* Steven D'Aprano: On Thu, 11 Feb 2010 23:26:34 +0100, Alf P. Steinbach wrote: I presume you agree that the name 'Alf P. Steinbach' refers to you. Do you then consider it to be a 'reference' to you? Yes, and that's irrelevant, because you can't change a name. Pardon me, but you most certainl

Pycrypto RSA ciphertext to string back to ciphertext issue

2010-02-11 Thread Jordan Apgar
Hey all, I'm trying to convert the encrypted data from RSA to a string for sending over xmlrpc and then back to usable data. Whenever I decrypt I just get junk data. Has anyone else tried doing this? Here's some example code: from Crypto.PublicKey import RSA from Crypto import Random key = RSA

Re: Need debugging knowhow for my creeping Unicodephobia

2010-02-11 Thread Nobody
On Wed, 10 Feb 2010 12:17:51 -0800, Anthony Tolle wrote: > 4. Consider switching to Python 3.x, since there is only one string > type (unicode). However: one drawback of Python 3.x is that the repr() of a Unicode string is no longer restricted to ASCII. There is an ascii() function which behaves

Re: python crash on windows but not on linux

2010-02-11 Thread hjebbers
On Feb 12, 12:13 am, Emile van Sebille wrote: > On 2/11/2010 6:32 AM hjebbers said... > > > To all, > > I am running an EDI translator, > > ... let's say bots  :) > > > and doing stress tests. > > When processing a test with a (relatively) big EDI file(s) on > > windowsXP  I get a crash: > >      

Re: python crash on windows but not on linux

2010-02-11 Thread hjebbers
On Feb 12, 12:13 am, Emile van Sebille wrote: > On 2/11/2010 6:32 AM hjebbers said... > > > To all, > > I am running an EDI translator, > > ... let's say bots  :) > > > and doing stress tests. > > When processing a test with a (relatively) big EDI file(s) on > > windowsXP  I get a crash: > >      

Re: python crash on windows but not on linux

2010-02-11 Thread hjebbers
On Feb 11, 11:56 pm, Carl Banks wrote: > On Feb 11, 2:39 pm, hjebbers wrote: > > > > > On Feb 11, 8:42 pm, Jerry Hill wrote: > > > > On Thu, Feb 11, 2010 at 9:32 AM, hjebbers wrote: > > > > To all, > > > > I am running an EDI translator, and doing stress tests. > > > > When processing a test wi

Re: Is a merge interval function available?

2010-02-11 Thread Nobody
On Wed, 10 Feb 2010 23:03:29 -0500, Steve Holden wrote: >> intervals = sorted(intervals, key = lambda x: x[0]) > > Since Python uses lexical sorting and the intervals are lists isn't the > key specification redundant here? Yes, but I wanted to make it explicit. Well, omitting the key= would

Re: Pycrypto RSA ciphertext to string back to ciphertext issue

2010-02-11 Thread MRAB
Jordan Apgar wrote: Hey all, I'm trying to convert the encrypted data from RSA to a string for sending over xmlrpc and then back to usable data. Whenever I decrypt I just get junk data. Has anyone else tried doing this? Here's some example code: from Crypto.PublicKey import RSA from Crypto im

Re: Please help with MemoryError

2010-02-11 Thread Steven D'Aprano
On Thu, 11 Feb 2010 15:39:09 -0800, Jeremy wrote: > My Python program now consumes over 2 GB of memory and then I get a > MemoryError. I know I am reading lots of files into memory, but not 2GB > worth. Are you sure? Keep in mind that Python has a comparatively high overhead due to its object-

Re: Please help with MemoryError

2010-02-11 Thread Tim Chase
Jonathan Gardner wrote: Don't use Python variables to store data long-term. Instead, setup a database or a file and use that. I'd first look at using a file, then using SQLite, and then a full-fledged database like PostgreSQL. Just to add to the mix, I'd put the "anydbm" module on the gradient

Re: timer for a function

2010-02-11 Thread Aahz
In article , mk wrote: > >self.conobj = paramiko.SSHClient() > >self.conobj.connect(self.ip, username=self.username, >key_filename=self.sshprivkey, port=self.port, timeout=opts.timeout) > >2. very slow SSH host that is hanging for 30+ seconds on key exchange. > >The timeout in the options regard

Re: python crash on windows but not on linux

2010-02-11 Thread Aahz
In article <34fcf680-1aa4-4835-9eba-3db3249f3...@q16g2000yqq.googlegroups.com>, hjebbers wrote: > >the error is a windows thing, I can make a screenshot of it, but I can >not copy/paste text. In that case, you need to -- very carefully -- make sure you transcribe exactly the message that you see

Re: Bizarre arithmetic results

2010-02-11 Thread Aahz
In article , Grant Edwards wrote: > >Didn't we just do this one last week? Let's do the Time Warp again! -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "At Resolver we've found it useful to short-circuit any doubt and just refer to comments in code as

Re: Modifying Class Object

2010-02-11 Thread Alf P. Steinbach
* Martin P. Hellwig: Well at least you are well written and more subtle than Xah Lee. Though I find him also quite amusing, I do like a good flame-war every now and again, and in that perspective I solute you. The technical discussion is now at point where one poster maintains that reference

Re: Please help with MemoryError

2010-02-11 Thread Aahz
In article , Tim Chase wrote: > >Just to add to the mix, I'd put the "anydbm" module on the gradient >between "using a file" and "using sqlite". It's a nice intermediate >step between rolling your own file formats for data on disk, and having >to write SQL since access is entirely like you'd do

Re: execute sqlite3 dot commands in python

2010-02-11 Thread Aahz
In article , Steve Holden wrote: > >No. That's not how you pass commands to sqlite3 - you connect to a >database, create a cursor on the connection, and then execute SQL >statements (not sqlite commands) on the cursor. Like this: > import sqlite3 c = sqlite3.connect("deleteme") cu

Re: how to make a SimpleXMLRPCServer abort at CTRL-C under windows

2010-02-11 Thread Aahz
In article , Gabriel Genellina wrote: > >Strange. With Python 2.6.4 I don't need to do that; I'd say the difference >is in the OS or antivirus (some AV are known to break the TCP stack). Perhaps, but I've also found that ctrl-C doesn't work on Windows. -- Aahz (a...@pythoncraft.com)

Re: Function attributes

2010-02-11 Thread Terry Reedy
On 2/11/2010 6:36 PM, Gabriel Genellina wrote: This is simple to implement, but requires changing the function definition. My goal was to keep the original code unchanged, that is, leave it as: def f(n): if n > 0: return n*f(n-1) elif n==0: return 1 (like a normal, recursive function), and mak

Re: python crash on windows but not on linux

2010-02-11 Thread Terry Reedy
On 2/11/2010 9:41 PM, Aahz wrote: In article<34fcf680-1aa4-4835-9eba-3db3249f3...@q16g2000yqq.googlegroups.com>, hjebbers wrote: the error is a windows thing, I can make a screenshot of it, but I can not copy/paste text. I think I know what box you mean. I believe this happened about 18 mo

Re: how to make a SimpleXMLRPCServer abort at CTRL-C under windows

2010-02-11 Thread Frank Millman
"Aahz" wrote in message news:hl2ob2$3i...@panix5.panix.com... In article , Gabriel Genellina wrote: Strange. With Python 2.6.4 I don't need to do that; I'd say the difference is in the OS or antivirus (some AV are known to break the TCP stack). Perhaps, but I've also found that ctrl-C doe

Re: Function attributes

2010-02-11 Thread Arnaud Delobelle
"Gabriel Genellina" writes: > En Thu, 11 Feb 2010 00:25:00 -0300, Terry Reedy > escribió: >> On 2/10/2010 4:49 PM, Gabriel Genellina wrote: >> >>> I've written a decorator for "injecting" a __function__ name into the >>> function namespace, but I can't find it anywhere. I think I implemented >>>

<    1   2