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

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

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

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: 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 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 11, 11:59 pm, Terry Reedy wrote: > On 2/11/2010 9:32 AM, hjebbers wrote: > > > > > To all, > > I am running an EDI translator, and doing stress tests. > > When processing a test with a (relatively) big EDI file(s) on > > windowsXP  I get a crash: > >      'sorry for the inconvenience' etc  

Re: Please help with MemoryError

2010-02-11 Thread Jonathan Gardner
On Feb 11, 3:39 pm, Jeremy wrote: > I have been using Python for several years now and have never run into > memory errors… > > until now. > Yes, Python does a good job of making memory errors the least of your worries as a programmer. Maybe it's doing too good of a job... > My Python program no

ANN: ActivePython 2.5.5.7 is now available

2010-02-11 Thread Sridhar Ratnakumar
I'm happy to announce that ActivePython 2.5.5.7 is now available for download from: http://www.activestate.com/activepython/ This is a minor release with several updates and fixes. Changes in 2.5.5.7 -- - Upgrade to Python 2.5.5 - Upgrade to Tcl/Tk 8.5.8 - Upgrade to PyWin32

Re: Please help with MemoryError

2010-02-11 Thread Alf P. Steinbach
* Jeremy: I have been using Python for several years now and have never run into memory errors… until now. 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. I thought I didn't have to worry about

Re: Please help with MemoryError

2010-02-11 Thread Stephen Hansen
On Thu, Feb 11, 2010 at 3:39 PM, 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. I thought I didn't have to worry about memory allocation > in Python because of the garbage col

Re: Function attributes

2010-02-11 Thread Gabriel Genellina
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 it by adding a fake additional argument and rep

Please help with MemoryError

2010-02-11 Thread Jeremy
I have been using Python for several years now and have never run into memory errors… until now. 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. I thought I didn't have to worry about memory alloc

Re: MODULE FOR I, P FRAME

2010-02-11 Thread Rhodri James
On Thu, 11 Feb 2010 19:31:52 -, DANNY wrote: Hello! I am currently developing a simple video player in python, and my problem is that i can't find a module which has a function that can determine if frame(image) is I or P coded (MPEG coding). I have been using PIL but I couldnt find anythi

Re: Need debugging knowhow for my creeping Unicodephobia

2010-02-11 Thread Terry Reedy
On 2/11/2010 4:43 PM, mk wrote: Neat, except that the process of porting most projects and external libraries to P3 seems to be, how should I put it, standing still? What is important are the libraries, so more new projects can start in 3.x. There is a slow trickly of 3.x support announcement

Re: Is a merge interval function available?

2010-02-11 Thread Peter
On Feb 12, 8:03 am, Jonathan Gardner wrote: > On Feb 10, 3:23 pm, Peng Yu wrote: > > > > > > > I'm wondering there is already a function in python library that can > > merge intervals. For example, if I have the following intervals ('[' > > and ']' means closed interval as > > inhttp://en.wikipe

Re: python and http POST

2010-02-11 Thread Terry Reedy
On 2/11/2010 2:11 PM, galileo228 wrote: Hey All, Been teaching myself Python for a few weeks, and am trying to write a program that will go to a url, enter a string in one of the search fields, submit the search, and return the contents of the search result. I'm using httplib2. My two particul

Re: python crash on windows but not on linux

2010-02-11 Thread Emile van Sebille
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: 'sorry for the inconvenience' etc (so no clues about what is causing the p

Re: python crash on windows but not on linux

2010-02-11 Thread Terry Reedy
On 2/11/2010 9:32 AM, hjebbers wrote: To all, I am running an EDI translator, and doing stress tests. When processing a test with a (relatively) big EDI file(s) on windowsXP I get a crash: 'sorry for the inconvenience' etc (so no clues about what is causing the problem) This happens with

Re: python crash on windows but not on linux

2010-02-11 Thread Carl Banks
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 with a (relatively) big EDI file(s) on > > > windows

Re: Bizarre arithmetic results

2010-02-11 Thread Terry Reedy
On 2/11/2010 11:23 AM, Jussi Piitulainen wrote: Robert Kern writes: On 2010-02-11 06:31 AM, Shashwat Anand wrote: There is a little issue here that '>>> -.1 ** .1' should give you error message. That is it. No, fractional powers of negative numbers are perfectly valid mathematically. The res

Re: python crash on windows but not on linux

2010-02-11 Thread hjebbers
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 with a (relatively) big EDI file(s) on > > windowsXP  I get a crash: > >    'sorry for the inconvenience' etc

Re: python crash on windows but not on linux

2010-02-11 Thread hjebbers
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 with a (relatively) big EDI file(s) on > > windowsXP  I get a crash: > >    'sorry for the inconvenience' etc

Re: Need debugging knowhow for my creeping Unicodephobia

2010-02-11 Thread Steve Holden
mk wrote: > MRAB wrote: > >> When working with Unicode in Python 2, you should use the 'unicode' type >> for text (Unicode strings) and limit the 'str' type to binary data >> (bytestrings, ie bytes) only. > > Well OK, always use u'something', that's simple -- but isn't str what I > get from files

Re: Modifying Class Object

2010-02-11 Thread Alf P. Steinbach
* Terry Reedy: On 2/11/2010 1:37 AM, Alf P. Steinbach wrote: Consider just the assert( t is not s ) t = s Does this change anything at all in the computer's memory? By 'computer', do you mean 'anything that computes' (including humans) or specifically 'electronic computer'? In this contex

Re: Modifying Class Object

2010-02-11 Thread Terry Reedy
On 2/11/2010 1:37 AM, Alf P. Steinbach wrote: Consider just the assert( t is not s ) t = s Does this change anything at all in the computer's memory? By 'computer', do you mean 'anything that computes' (including humans) or specifically 'electronic computer'? But since it does have an eff

Re: calculating a string equation

2010-02-11 Thread Arnaud Delobelle
Astan Chee writes: > Hi, > I have some variables in my script that looks like this: > vars = {'var_a':'10','var_b':'4'} > eqat = "(var_a/2.0) <= var_b" > result = "(var_a+var_b)/7" > What I'm trying to do is to plug in var_a and var_b's values from vars > into eqat and see if eqat returns true or

Re: Need debugging knowhow for my creeping Unicodephobia

2010-02-11 Thread Robert Kern
On 2010-02-11 15:43 PM, mk wrote: MRAB wrote: Strictly speaking, only Unicode can be encoded. How so? Can't bytestrings containing characters of, say, koi8r encoding be encoded? I think he means that only unicode objects can be encoded using the .encode() method, as clarified by his next

calculating a string equation

2010-02-11 Thread Astan Chee
Hi, I have some variables in my script that looks like this: vars = {'var_a':'10','var_b':'4'} eqat = "(var_a/2.0) <= var_b" result = "(var_a+var_b)/7" What I'm trying to do is to plug in var_a and var_b's values from vars into eqat and see if eqat returns true or false as well as getting the va

Re: Need debugging knowhow for my creeping Unicodephobia

2010-02-11 Thread mk
MRAB wrote: When working with Unicode in Python 2, you should use the 'unicode' type for text (Unicode strings) and limit the 'str' type to binary data (bytestrings, ie bytes) only. Well OK, always use u'something', that's simple -- but isn't str what I get from files and sockets and the like

Re: Is a merge interval function available?

2010-02-11 Thread Alf P. Steinbach
* Jonathan Gardner: On Feb 10, 3:23 pm, Peng Yu wrote: I'm wondering there is already a function in python library that can merge intervals. For example, if I have the following intervals ('[' and ']' means closed interval as inhttp://en.wikipedia.org/wiki/Interval_(mathematics)#Excluding_the_

Re: Is a merge interval function available?

2010-02-11 Thread Jonathan Gardner
On Feb 10, 3:23 pm, Peng Yu wrote: > I'm wondering there is already a function in python library that can > merge intervals. For example, if I have the following intervals ('[' > and ']' means closed interval as > inhttp://en.wikipedia.org/wiki/Interval_(mathematics)#Excluding_the_end...) > > [1,

Re: Terminating threaded programs

2010-02-11 Thread mk
Aahz wrote: You can also use os._exit(). Yes! It works cleanly! Thanks a million! OTOH, if I use sys.exit(), it's just hanging there. Regards, mk -- http://mail.python.org/mailman/listinfo/python-list

Re: Terminating threaded programs

2010-02-11 Thread mk
Aahz wrote: You can also use os._exit(). Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Terminating threaded programs

2010-02-11 Thread mk
Stephen Hansen wrote: I use threads all the time (well, for certain types of workloads) and have never seen this. Are your threads daemon threads? The only time I've seen sys.exit() not close out my program is when I'm launching non-daemon threads on accident. The snag is that my program is

Re: Modifying Class Object

2010-02-11 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Steve Holden: [...] In this particular part of the thread I am attempting, unsuccessfully, to convince you that a change in *your* behavior would lead to less hostility directed towards the way you present your ideas. You apparently feel it is quite a

Re: PExpect Cross-Platform Alternative

2010-02-11 Thread Steve Holden
Nathan Farrar wrote: > Hello Community, > > Recently I've been automating lots of network operations tasks via > simple python scripts. Originally, I utilized paramiko but found that > the module had issues working with cisco equipment. I switched to > pexpect and things have worked wonderfully

Re: python and http POST

2010-02-11 Thread Ken Seehart
"Use tamperdata to view and modify HTTP/HTTPS headers and post parameters... " https://addons.mozilla.org/en-US/firefox/addon/966 Enjoy, Ken galileo228 wrote: Hey All, Been teaching myself Python for a few weeks, and am trying to write a program that will go to a url, enter a string in one o

Re: Modifying Class Object

2010-02-11 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Steven D'Aprano: [...] accusing them of lying for having an opinion that differs from yours, That is untrue. Well, that says it all really. You seem to insinuate that I'm saying that Steven is lying, and/or that Steven is lying. From context an

PExpect Cross-Platform Alternative

2010-02-11 Thread Nathan Farrar
Hello Community, Recently I've been automating lots of network operations tasks via simple python scripts. Originally, I utilized paramiko but found that the module had issues working with cisco equipment. I switched to pexpect and things have worked wonderfully since (I've been running this scr

Re: python crash on windows but not on linux

2010-02-11 Thread hjebbers
On Feb 11, 7:01 pm, Peter Otten <__pete...@web.de> wrote: > hjebbers wrote: > > On Feb 11, 5:45 pm, M3RT wrote: > >> The problem may be related to how you treat the EDI file or lets say > >> DATA. Also your coding style is important. Can you provide more info? > > > Yes, a whole lot more; but I do

Re: python crash on windows but not on linux

2010-02-11 Thread Jerry Hill
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 with a (relatively) big EDI file(s) on > windowsXP  I get a crash: >    'sorry for the inconvenience' etc  (so no clues about what is > causing the problem)

MODULE FOR I, P FRAME

2010-02-11 Thread DANNY
Hello! I am currently developing a simple video player in python, and my problem is that i can't find a module which has a function that can determine if frame(image) is I or P coded (MPEG coding). I have been using PIL but I couldnt find anything that could help me with that problem. Thanks for

Re: python crash on windows but not on linux

2010-02-11 Thread hjebbers
On Feb 11, 7:01 pm, Peter Otten <__pete...@web.de> wrote: > hjebbers wrote: > > On Feb 11, 5:45 pm, M3RT wrote: > >> The problem may be related to how you treat the EDI file or lets say > >> DATA. Also your coding style is important. Can you provide more info? > > > Yes, a whole lot more; but I do

Re: python crash on windows but not on linux

2010-02-11 Thread hjebbers
On Feb 11, 7:01 pm, Peter Otten <__pete...@web.de> wrote: > hjebbers wrote: > > On Feb 11, 5:45 pm, M3RT wrote: > >> The problem may be related to how you treat the EDI file or lets say > >> DATA. Also your coding style is important. Can you provide more info? > > > Yes, a whole lot more; but I do

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread mk
Peter Otten wrote: try: ... except socket.error: ... #untested import socket class SocketWrapper: def __getattr__(self, name): return getattr(socket, name) error = None import module_using_socket module_using_socket.socket = SocketWrapper() Very interesting solution.

python and http POST

2010-02-11 Thread galileo228
Hey All, Been teaching myself Python for a few weeks, and am trying to write a program that will go to a url, enter a string in one of the search fields, submit the search, and return the contents of the search result. I'm using httplib2. My two particular questions: 1) When I set my 'body' var

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread mk
Paul Rubin wrote: mk writes: Um... run your code in a debugger. ..except the code in question is multithreaded and pdb is no good for that, and last time I checked, yappi was broken. Try winpdb.org. This is a treasure! In minutes I've had this attached to remote process and debugging thre

Re: Terminating threaded programs

2010-02-11 Thread sstein...@gmail.com
On Feb 11, 2010, at 11:43 AM, Aahz wrote: > In article , > mk wrote: >> >> I have a problem with a threaded program: it frequently hangs on sys.exit. >> >> The problem is that my program uses threads which in turn use paramiko >> library, which itself is threaded. >> >> I try to gracefully

Re: ANN: obfuscate

2010-02-11 Thread Mark Lawrence
Christian Heimes wrote: Gregory Ewing wrote: Actually I gather it had a lot to do with the fact that the Germans made some blunders in the way they used the Enigma that seriously compromised its security. There was reportedly a branch of the German forces that used their Enigmas differently, avo

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread Steve Holden
mk wrote: > Stephen Hansen wrote: >> the uncommon, the exceptional, case. If one could somehow turn off >> exceptions, you can't even do a for loop: every for loop would become >> infinite-- exceptions are how Python signals the end of an iterator. >> Think about that, *every* for loop in Python su

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread Peter Otten
mk wrote: > >> the uncommon, the exceptional, case. If one could somehow turn off >> exceptions, you can't even do a for loop: every for loop would become >> infinite-- exceptions are how Python signals the end of an iterator. >> Think about that, *every* for loop in Python suddenly breaks. > >

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread mk
Stephen Hansen wrote: the uncommon, the exceptional, case. If one could somehow turn off exceptions, you can't even do a for loop: every for loop would become infinite-- exceptions are how Python signals the end of an iterator. Think about that, *every* for loop in Python suddenly breaks. Hm

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread Paul Rubin
mk writes: >> Um... run your code in a debugger. > > ..except the code in question is multithreaded and pdb is no good for > that, and last time I checked, yappi was broken. Try winpdb.org. -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: obfuscate

2010-02-11 Thread MRAB
Paul Rubin wrote: Gregory Ewing writes: Actually I gather it had a lot to do with the fact that the Germans made some blunders in the way they used the Enigma that seriously compromised its security. There was reportedly a branch of the German forces that used their Enigmas differently, avoidin

Re: ANN: obfuscate

2010-02-11 Thread Matthew Barnett
Paul Rubin wrote: Gregory Ewing writes: Actually I gather it had a lot to do with the fact that the Germans made some blunders in the way they used the Enigma that seriously compromised its security. There was reportedly a branch of the German forces that used their Enigmas differently, avoidin

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread mk
the uncommon, the exceptional, case. If one could somehow turn off exceptions, you can't even do a for loop: every for loop would become infinite-- exceptions are how Python signals the end of an iterator. Think about that, *every* for loop in Python suddenly breaks. Ouch. Sure I can,

Re: ANN: obfuscate

2010-02-11 Thread MRAB
Christian Heimes wrote: Gregory Ewing wrote: Actually I gather it had a lot to do with the fact that the Germans made some blunders in the way they used the Enigma that seriously compromised its security. There was reportedly a branch of the German forces that used their Enigmas differently, avo

Re: Need debugging knowhow for my creeping Unicodephobia

2010-02-11 Thread MRAB
mk wrote: kj wrote: I have read a *ton* of stuff on Unicode. It doesn't even seem all that hard. Or so I think. Then I start writing code, and WHAM: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128) (There, see? My Unicodephobia just went u

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread Stephen Hansen
On Thu, Feb 11, 2010 at 9:32 AM, mk wrote: > Simon Brunning wrote: > >> Not as far as I know. Besides, the chances are that if you were to be >> able to turn off exception handling altogether your code wouldn't make >> it as far as the code you are interested in anyway. >> > > Sure, but I could d

Re: Need debugging knowhow for my creeping Unicodephobia

2010-02-11 Thread kj
In mk writes: >To make matters more complicated, str.encode() internally DECODES from >string into unicode: > >>> nu >'\xc4\x84' > >>> > >>> type(nu) > > >>> nu.encode() >Traceback (most recent call last): > File "", line 1, in >UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in

Re: Dreaming of new generation IDE

2010-02-11 Thread Francis Carr
> I can't believe the code editing situation today is in a such sorry > state. I can't believe an old coder is feeling so sorry for himself. > Today, I tried to understand the twisted.web.client code and I found 3 > methods I couldn't find by who were called. > > I asked on the mailing list and t

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread mk
Simon Brunning wrote: Not as far as I know. Besides, the chances are that if you were to be able to turn off exception handling altogether your code wouldn't make it as far as the code you are interested in anyway. Sure, but I could deal with that, jerry-rigging the code as exceptions go by, f

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread Simon Brunning
On 11 February 2010 16:17, mk wrote: > I'm getting an exception (on socket) handled in a program I'm trying to > debug. I have trouble locating where exactly that happens. > > In such situation turning exception handling off could be useful, bc > unhandled exception stack trace is precisely what I

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread mk
Steve Holden wrote: I'm getting an exception (on socket) handled in a program I'm trying to debug. I have trouble locating where exactly that happens. If the exception is currently being trapped by a handler in your code It's not my code. you could just insert a "raise" statement at the st

Re: Terminating threaded programs

2010-02-11 Thread Aahz
In article , mk wrote: > >I have a problem with a threaded program: it frequently hangs on sys.exit. > >The problem is that my program uses threads which in turn use paramiko >library, which itself is threaded. > >I try to gracefully close the threads (below), but it doesn't always >work, if pa

Re: Dreaming of new generation IDE

2010-02-11 Thread Bruno Desthuilliers
catonano a écrit : (snip) Today, I tried to understand the twisted.web.client code and I found 3 methods I couldn't find by who were called. I asked on the mailing list and they suggested me where they were called and that the tool for such thing is "grep". So, you grep, you get a list of files

Re: Need debugging knowhow for my creeping Unicodephobia

2010-02-11 Thread mk
kj wrote: I have read a *ton* of stuff on Unicode. It doesn't even seem all that hard. Or so I think. Then I start writing code, and WHAM: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128) (There, see? My Unicodephobia just went up a notch.)

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread Steve Holden
mk wrote: > Hello everyone, > > I'm getting an exception (on socket) handled in a program I'm trying to > debug. I have trouble locating where exactly that happens. > > In such situation turning exception handling off could be useful, bc > unhandled exception stack trace is precisely what I'm try

Re: Bizarre arithmetic results

2010-02-11 Thread Jussi Piitulainen
Robert Kern writes: > On 2010-02-11 06:31 AM, Shashwat Anand wrote: > > There is a little issue here that '>>> -.1 ** .1' should give you > > error message. That is it. > > No, fractional powers of negative numbers are perfectly valid > mathematically. The result is a complex number. In Python 3 (

Re: method names nounVerb or verbNoun

2010-02-11 Thread Martin P. Hellwig
On 02/05/10 19:53, Wanderer wrote: Which is the more accepted way to compose method names nounVerb or verbNoun? For example voltageGet or getVoltage? getVoltage sounds more normal, but voltageGet is more like voltage.Get. I seem to mix them and I should probably pick one way and stick with it.

Any way to turn off exception handling? (debugging)

2010-02-11 Thread mk
Hello everyone, I'm getting an exception (on socket) handled in a program I'm trying to debug. I have trouble locating where exactly that happens. In such situation turning exception handling off could be useful, bc unhandled exception stack trace is precisely what I'm trying to obtain. Any

Re: Modifying Class Object

2010-02-11 Thread Steve Holden
Alf P. Steinbach wrote: > * Steven D'Aprano: [...] >> accusing them of lying for having an opinion that differs from yours, > > That is untrue. > Well, that says it all really. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 PyCon is coming! Atlanta, Feb 2010 http://

Re: Modifying Class Object

2010-02-11 Thread Steve Holden
Alf P. Steinbach wrote: > * Steve Holden: [...] >> In this particular part of the thread I am attempting, unsuccessfully, >> to convince you that a change in *your* behavior would lead to less >> hostility directed towards the way you present your ideas. >> >> You apparently feel it is quite accept

Re: Bizarre arithmetic results

2010-02-11 Thread Robert Kern
On 2010-02-11 06:31 AM, Shashwat Anand wrote: Do you really believe that -0.1 ** 0.1 is a valid computational problem ? Can you raise a negative number to a fractional power ? Output on my console (python 2.6) >>> -.1 ** .1 -0.79432823472428149 >>> a,b = -.1,.1 >>> a**b Traceback (most recent

Re: method names nounVerb or verbNoun

2010-02-11 Thread cjw
On 05-Feb-10 14:53 PM, Wanderer wrote: Which is the more accepted way to compose method names nounVerb or verbNoun? For example voltageGet or getVoltage? getVoltage sounds more normal, but voltageGet is more like voltage.Get. I seem to mix them and I should probably pick one way and stick with i

python crash on windows but not on linux

2010-02-11 Thread hjebbers
To all, I am running an EDI translator, and doing stress tests. When processing a test with a (relatively) big EDI file(s) on windowsXP I get a crash: 'sorry for the inconvenience' etc (so no clues about what is causing the problem) This happens with python 2.4, 2.5, 2.6 It does not happen i

Re: Bizarre arithmetic results

2010-02-11 Thread Mark Dickinson
On Feb 11, 1:38 pm, Duncan Booth wrote: > Tim Chase wrote: > > But perhaps Py3 changes evaluation, returning an complex number. > > Yes, the change is documented > athttp://docs.python.org/3.1/reference/expressions.html#the-power-operator > > If it is in any of the "What's new in Python x.xx" do

Re: how to improve this cycle (extracting data from structured array)?

2010-02-11 Thread Alexzive
On Feb 11, 1:08 pm, Tim Chase wrote: > Alexzive wrote: > > I am just wondering if there is a quick way to improve this algorithm > > [N is a structured array which hold info about the nodes n of a finite > > element mesh, and n is about 300.000). I need to extract info from N > > and put it in to

base32hex support in python?

2010-02-11 Thread Vishal Shetye
Hi, One of the modules that I am currently working on requires base32hex encoding as defined by RFC 4648, section 7. I checked base64 module which has base32encode/decode functionality but not with extended hex alphabet. Is there a module, currently available, that provides this? As far as I see

Re: Bizarre arithmetic results

2010-02-11 Thread Duncan Booth
Tim Chase wrote: > But perhaps Py3 changes evaluation, returning an complex number. Yes, the change is documented at http://docs.python.org/3.1/reference/expressions.html#the-power-operator If it is in any of the "What's new in Python x.xx" documents or in a PEP somewhere I haven't spotted it

Re: Your beloved python features

2010-02-11 Thread jhermann
$ python -c "import this" -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >