Re: remove last 76 letters from string

2009-08-06 Thread Iain King
On Aug 6, 11:34 am, MRAB wrote: > Iain King wrote: > >>      print >>nucleotides, seq[-76] > > >>      last_part = line.rstrip()[-76 : ] > > > You all mean:   seq[:-76]   , right? (assuming you've already stripped > > any junk off the end of the string) > > The OP said "cut out the last 76 letters

Re: Python docs disappointing - group effort to hire writers?

2009-08-06 Thread Terry Reedy
RayS wrote: At 08:35 PM 8/5/2009 -0700, r wrote: """... Any real sense of community is undermined -- or even destroyed -- to be replaced by virtual equivalents that strive, unsuccessfully, to synthesize a sense of community.""" I've brought up the idea of the quasi-community doc that PHP uses

Re: Overlap in python

2009-08-06 Thread Marcus Wanner
On 8/5/2009 10:56 AM, nn wrote: On Aug 5, 7:13 am, Marcus Wanner wrote: On 8/4/2009 6:09 PM, MRAB wrote: >>> parts = [(5, 9, "a"), (7, 10, "b"), (3, 6, "c"), (15, 20, "d"), (18, 23, "e")] >>> parts.sort() >>> parts [(3, 6, 'c'), (5, 9, 'a'), (7, 10, 'b'), (15, 20, 'd'), (18, 23, 'e')] >>>

one method of COM object needs a variant type variable

2009-08-06 Thread MICHÁLEK Jan Mgr .
How i can use this type in win32.com? One method of com object (geomedia storage service) needs this variable for storage geometry of geometry object (this variable will be writen into blob in DB). Is possible make this variable in py?? Thanks Jelen/Stack -- http://mail.python.org/mailman/listi

inspect.stack() performance

2009-08-06 Thread Doron Tal
I use inspect.stack() to extract some info, such as file name, function name and line number, for the sake of logging (home brew logger). I tested to see how much time it takes to execute the command: Python 2.4.3 (#1, Jan 21 2009, 01:11:33) [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2 Type "

Re: Cython + setuptools not working with .pyx,only with .c-files

2009-08-06 Thread David Cournapeau
On Thu, Aug 6, 2009 at 7:38 PM, Diez B. Roggisch wrote: > Hi, > > > I'm trying to build a Cython-extension as Egg. > > However, this doesn't work - I can either use distutils to build the > extension, creating a myextension.c-file on the way. > > If that's there, I can use setuptools to build the e

RE: os.system in a service

2009-08-06 Thread Lawrence Wong
I actually found the solution. I was trying to copy a file from another computer to the current one. My 'access was denied'. So I had to go to my service at Admin Tools --> Services and 'Log on as' the Administrator. Was ok after that. Thanks for your responses everyone. > To: python-li

Re: Using Python to automate builds

2009-08-06 Thread David Cournapeau
On Thu, Aug 6, 2009 at 12:39 AM, Kosta wrote: > > Setenv.bat sets up the path and other environment variables build.exe > needs to compile and link (and even binplace) its utilities.  So > building itself is not the issue.  The problem is that if I call > setenv.bat from Python and then build.exe,

Re: Subclassing Python's dict

2009-08-06 Thread Carl Banks
On Aug 5, 7:39 am, Bruno Desthuilliers wrote: > Sergey Simonenko a écrit : > > > Hi, > > > I subclass builtin 'dict' in my application and experience some problems > > with it. > > > The whole issue is that I should redefine 'setdefault' and 'update' > > methods after redefining '__setitem__' or/a

Cython + setuptools not working with .pyx,only with .c-files

2009-08-06 Thread Diez B. Roggisch
Hi, I'm trying to build a Cython-extension as Egg. However, this doesn't work - I can either use distutils to build the extension, creating a myextension.c-file on the way. If that's there, I can use setuptools to build the egg. But when I remove the .c-file, the .pyx-file isn't used to re-gen

Re: Problem in installing PyGreSQL

2009-08-06 Thread Thangappan.M
I have downloaded the psycopg2 tar file from the following link. http://initd.org/tracker/psycopg I have done the following things. * Extracting the files from the tar file * tried to execute python ./setup.py build It gives the following error. #python ./setup.py build runni

Re: remove last 76 letters from string

2009-08-06 Thread MRAB
Iain King wrote: print >>nucleotides, seq[-76] last_part = line.rstrip()[-76 : ] You all mean: seq[:-76] , right? (assuming you've already stripped any junk off the end of the string) The OP said "cut out the last 76 letters (nucleotides) from each individual sequence and sen

handling kill signal

2009-08-06 Thread sanju ps
I want to handle a kill signal..In my program i wrote like this def handler(signum, frame): print "Signal",signum delete_temp_file() exit(1) signal.signal(signal.SIGTERM, handler) And when i tried pkill processid .program is exited but not deleting the temp file -- http://mail.python

Re: How to comment on a Python PEP?

2009-08-06 Thread Martin v. Löwis
> Is there a mechanism for submitting comments on a Python PEP? You post to python-dev or comp.lang.python, and you CC the author. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-06 Thread sgriffiths
On Aug 5, 3:46 pm, "Martin P. Hellwig" wrote: > Hi List, > > On several occasions I have needed (and build) a parser that reads a > binary piece of data with custom structure. For example (bogus one): > > BE > +-+-+-+-+--++ > | Version | Command

Re: remove last 76 letters from string

2009-08-06 Thread Xavier Ho
On Thu, Aug 6, 2009 at 6:28 PM, Iain King wrote: > > print >>nucleotides, seq[-76] > > > last_part = line.rstrip()[-76 : ] > > You all mean: seq[:-76] , right? (assuming you've already stripped > any junk off the end of the string) > I think so, probably both of them typo'd. (What

Re: os.system in a service

2009-08-06 Thread Gabriel Genellina
En Thu, 06 Aug 2009 03:59:13 -0300, Diez B. Roggisch escribió: Gabriel Genellina schrieb: En Wed, 05 Aug 2009 13:07:39 -0300, Lawrence Wong escribió: I wrote a program which runs a .bat file using os.system like: 'os.system(pathToBatFile)' and everything was good. Then I decided to tu

Re: remove last 76 letters from string

2009-08-06 Thread Iain King
> print >>nucleotides, seq[-76] >      last_part = line.rstrip()[-76 : ] You all mean: seq[:-76] , right? (assuming you've already stripped any junk off the end of the string) Iain -- http://mail.python.org/mailman/listinfo/python-list

Re: String to valid Python identifier

2009-08-06 Thread Martin v. Löwis
> Is there any easy function in the stdlib to convert any random string in > a valid Python identifier .. possibly by replacing non-valid characters > with _ ? I think this is fairly underspecified as a problem statement. A solution that would meet your specification would be def mkident(s):

Re: Subclassing Python's dict

2009-08-06 Thread Xavier Ho
On Thu, Aug 6, 2009 at 1:19 PM, alex23 wrote: > Xavier Ho wrote: > > You should subclass collections.UserDict, and not the default dict class. > > Refer to the collections module. > > Xavier, why do you think that is the correct approach? I'll be honest first and say that I do not completely un

Re: merge two png pic

2009-08-06 Thread Xavier Ho
On Thu, Aug 6, 2009 at 12:17 PM, cocobear wrote: > > I want to view image use Windows Pic View. > > If you run out of memory trying to combining those images into a 30k by 40k pixels image, the Windows Pic View isn't going to be able to display it either. Regards, Ching-Yun "Xavier" Ho, Technic

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-06 Thread Hendrik van Rooyen
On Wednesday 05 August 2009 21:41:26 Martin P. Hellwig wrote: > Yes you are (of course) right, my 'dream' solution would be something > that accepts slice indeces on bit level. Your reasoning did reveal some > flaws in my approach though ;-) This is the first time I have been compared to the sand

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-06 Thread Hendrik van Rooyen
On Wednesday 05 August 2009 20:12:05 Paul Rubin wrote: > "Martin P. Hellwig" writes: > > what I usually do is read the packet in binary mode, convert the > > output to a concatenated 'binary string'(i.e. '0101011000110') and > > Something wrong with reading the data words as an integer and using >

Re: Datetime with float seconds

2009-08-06 Thread kpal
On Aug 6, 7:43 am, Hendrik van Rooyen wrote: > I am curious as to what would require less than microsecond > timing - about the only thing I can think of would be something > involving measuring the speed of light, where nanoseconds > or better would be nice. You are right :-) I am trying to wri

How to comment on a Python PEP?

2009-08-06 Thread Dr. Phillip M. Feldman
Is there a mechanism for submitting comments on a Python PEP? -- View this message in context: http://www.nabble.com/How-to-comment-on-a-Python-PEP--tp24840417p24840417.html Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinfo/python

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-06 Thread Hendrik van Rooyen
On Wednesday 05 August 2009 16:46:13 Martin P. Hellwig wrote: > Hi List, > > On several occasions I have needed (and build) a parser that reads a > binary piece of data with custom structure. For example (bogus one): > > BE > +-+-+-+-+--++ > > | V

Re: os.system in a service

2009-08-06 Thread Diez B. Roggisch
Gabriel Genellina schrieb: En Wed, 05 Aug 2009 13:07:39 -0300, Lawrence Wong escribió: I wrote a program which runs a .bat file using os.system like: 'os.system(pathToBatFile)' and everything was good. Then I decided to turn my program into a service as opposed to being run with the comman

<    1   2