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 marc...@cox.net 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

Re: Using Python to automate builds

2009-08-05 Thread Marcus Wanner
On 8/4/2009 5:52 PM, Philip Semanchuk wrote: On Aug 4, 2009, at 5:40 PM, Kosta wrote: On Aug 4, 2:34 pm, Dave Angel da...@ieee.org wrote: + I have released pyKook 0.0.2. +http://pypi.python.org/pypi/Kook/0.0.2 +http://www.kuwata-lab.com/kook/

Re: Overlap in python

2009-08-05 Thread Marcus Wanner
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')] # Merge overlapping intervals. pos = 1 while pos len(parts): # Merge the pair in

Re: Overlap in python

2009-08-04 Thread Marcus Wanner
On Aug 4, 2:15 pm, Jay Bird jay.bird0...@gmail.com wrote: Hi everyone, I've been trying to figure out a simple algorithm on how to combine a list of parts that have 1D locations that overlap into a non- overlapping list.  For example, here would be my input: part name   location a          

Re: Overlap in python

2009-08-04 Thread Marcus Wanner
On 8/4/2009 2:46 PM, Ann wrote: On Aug 4, 11:31 am, Marcus Wanner marc...@cox.net wrote: On Aug 4, 2:15 pm, Jay Bird jay.bird0...@gmail.com wrote: Hi everyone, I've been trying to figure out a simple algorithm on how to combine a list of parts that have 1D locations that overlap into a non

Re: Is it possible to have the python color in the terminal ?

2009-08-04 Thread Marcus Wanner
On 8/4/2009 2:53 PM, aurelien wrote: Hello, I am under gNewSense, i am a newbbie on Python, i look for how change the color terminal when python run. at the step all is in black and white. Is it possible to have the python color in the terminal ? Thanks for your help. aurelien You might try

Re: Is python buffer overflow proof?

2009-08-03 Thread Marcus Wanner
On 8/3/2009 3:45 AM, Diez B. Roggisch wrote: Marcus Wanner schrieb: On 8/2/2009 10:43 AM, Christian Heimes wrote: Marcus Wanner wrote: I believe that python is buffer overflow proof. In fact, I think that even ctypes is overflow proof... No, ctypes isn't buffer overflow proof. ctypes can

Re: Help understanding the decisions *behind* python?

2009-08-02 Thread Marcus Wanner
On 8/1/2009 9:31 PM, sturlamolden wrote: - Python and C programmers use lists and arrays similarly. I'm guessing that's because of the brackets... Marcus -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python buffer overflow proof?

2009-08-02 Thread Marcus Wanner
On 8/2/2009 9:50 AM, Jizzai wrote: Is a _pure_ python program buffer overflow proof? For example in C++ you can declare a char[9] to hold user input. If the user inputs 10+ chars a buffer overflow occurs. In python, I cannot seem to find a way to define/restrict a string length. This is

Re: Seeding the rand() Generator

2009-08-02 Thread Marcus Wanner
On 8/2/2009 9:42 AM, Fred Atkinson wrote: How does one seed the rand() generator when retrieving random recordings in MySQL? Regards, Fred something like: import random, time random.seed(time.time()) #not actual record access code: sqlite3.recordaccessfuction(recordid =

Re: Is python buffer overflow proof?

2009-08-02 Thread Marcus Wanner
On 8/2/2009 10:43 AM, Christian Heimes wrote: Marcus Wanner wrote: I believe that python is buffer overflow proof. In fact, I think that even ctypes is overflow proof... No, ctypes isn't buffer overflow proof. ctypes can break and crash a Python interpreter easily. Christian I see. I

Re: How to read webpage

2009-08-01 Thread Marcus Wanner
On 8/1/2009 11:31 AM, Jon Clements wrote: On 1 Aug, 14:52, MRAB pyt...@mrabarnett.plus.com wrote: tarun wrote: Dear All, I want to read a webpage and copy the contents of it in word file. I tried to write following code: import urllib2 urllib2.urlopen(http://www.rediff.com/;) *Error:-*

Re: threads check socket

2009-07-31 Thread Marcus Wanner
On 7/31/2009 12:35 PM, NighterNet wrote: I been trying to find a way to check the socket is open or not. The thread are in a group and loop if the sockets are open. If they are not open delete the thread and remove the group. I need on this. Being a bit more specific would help. Are you using

Re: Regexp problem

2009-07-30 Thread Marcus Wanner
On 7/30/2009 9:32 AM, Beldar wrote: On 30 jul, 15:07, MRAB pyt...@mrabarnett.plus.com wrote: Beldar wrote: Hi there! I have a problem and i'm not very good at regular expressions. I have a text like lalala lalala tiruri beldar-is-listening tiruri lalala I need a regexp to get the 'beldar'

Re: fast video encoding

2009-07-29 Thread Marcus Wanner
On 7/29/2009 4:14 AM, gregorth wrote: Hi all, for a scientific application I need to save a video stream to disc for further post processing. My cam can deliver 8bit grayscale images with resolution 640x480 with a framerate up to 100Hz, this is a data rate of 30MB/s. Writing the data

Re: simple splash screen?

2009-07-29 Thread Marcus Wanner
On 7/28/2009 11:58 PM, NighterNet wrote: I am trying to make a simple splash screen from python 3.1.Not sure where to start looking for it. Can any one help? Trying to make a splash screen for python? Or trying to do image processing in python? Marcus --

Re: about analyze object's stack usage

2009-07-29 Thread Marcus Wanner
On 7/29/2009 3:51 AM, hch wrote: Is there a python script can get a list of how much stack space each function in your program uses? I don't think so. You could try raw reading of the memory from another thread using ctypes and pointers, but that would be madness. ( the program is compiled by

Re: Does python have the capability for driver development ?

2009-07-29 Thread Marcus Wanner
On 7/29/2009 7:44 PM, Martin P. Hellwig wrote: Rodrigo S Wanderley wrote: cut What about user level device drivers? Think the Python VM could communicate with the driver through the user space API. Is there a Python module for that? Sure why not? Look for example to libusb, which provides

Re: len() should always return something

2009-07-25 Thread Marcus Wanner
On 7/25/2009 5:34 AM, Hendrik van Rooyen wrote: On Friday 24 July 2009 22:09:15 Marcus Wanner wrote: First one to correctly decompress the value 0 into an ASCII character wins the title of the world's most capable hacker :p that is easy. the xor of 0 and 1 is 1, which is ASCII soh, if I

Re: len() should always return something

2009-07-25 Thread Marcus Wanner
On 7/25/2009 10:08 AM, Piet van Oostrum wrote: Steven D'Aprano st...@remove-this-cybersource.com.au (SD) wrote: SD Ambiguity essentially boils down to being unable to reasonably predict SD the expectation of the coder. I say reasonably, because if you allow SD unreasonable situations,

Re: any suggestions to synchronize typed text and speech ?

2009-07-24 Thread Marcus Wanner
On 7/21/2009 12:13 PM, Stef Mientki wrote: hi Marcus, That sounds like a very specialized type of thing, Well from an application point of view, with the current netbooks, this looks like a perfect tool for any conversation or meeting. which only the few people with experience with wxPython,

Re: len() should always return something

2009-07-24 Thread Marcus Wanner
On 7/24/2009 3:04 PM, Roy Smith wrote: In article 0279f596$0$5185$c3e8...@news.astraweb.com, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Fri, 24 Jul 2009 16:50:03 +0200, superpollo wrote: Nah. 7 contains three bits, so len(7) should *clearly* return 3. and len(7) must

Re: len() should always return something

2009-07-24 Thread Marcus Wanner
On 7/24/2009 4:18 PM, Mark Lawrence wrote: Marcus Wanner wrote: On 7/24/2009 3:04 PM, Roy Smith wrote: In article 0279f596$0$5185$c3e8...@news.astraweb.com, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Fri, 24 Jul 2009 16:50:03 +0200, superpollo wrote: Nah. 7 contains

Re: If Scheme is so good why MIT drops it?

2009-07-20 Thread Marcus Wanner
On 7/20/2009 2:13 AM, Paul Rubin wrote: Steven D'Aprano ste...@remove.this.cybersource.com.au writes: Besides, one can legitimately disagree that 2/3 = 0 is the wrong thing to do. It's the right thing to do if you're doing integer maths. I wonder whether 2/3 = ValueError is preferable. Not

Re: any suggestions to synchronize typed text and speech ?

2009-07-20 Thread Marcus Wanner
On 7/20/2009 5:34 AM, Stef Mientki wrote: thanks Marcus, Marcus Wanner wrote: On 7/19/2009 4:15 PM, Stef Mientki wrote: hello, I'm using Scintilla as a wxPython widget with great pleasure. I now have an application where I want to make notes during a conversation, but also want to record

Re: Design question.

2009-07-20 Thread Marcus Wanner
On 7/20/2009 9:42 AM, Lacrima wrote: On Jul 20, 4:05 pm, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Lacrima wrote: Hello! I am newbie in python and I have really simple question, but I need your advice to know how to do best. I need to store a number of dictionaries in certain place.

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Marcus Wanner
On 7/20/2009 3:26 PM, Phillip B Oldham wrote: On Jul 20, 6:08 pm, Duncan Booth duncan.bo...@invalid.invalid wrote: The main reason why you need both lists and tuples is that because a tuple of immutable objects is itself immutable you can use it as a dictionary key. Really? That sounds

Re: any suggestions to synchronize typed text and speech ?

2009-07-19 Thread Marcus Wanner
On 7/19/2009 4:15 PM, Stef Mientki wrote: hello, I'm using Scintilla as a wxPython widget with great pleasure. I now have an application where I want to make notes during a conversation, but also want to record the speech during that conversation. I'm using Scintilla as a wxPython widget for

Re: Python graphics / imaging library

2009-07-18 Thread Marcus Wanner
On 7/18/2009 11:41 AM, Peter Chant wrote: Max Erickson wrote: More recent months contain updates to the status of 1.1.7, it is headed towards a release. Preliminary tarballs and binaries are available on effbot.org: http://effbot.org/downloads/#imaging http://effbot.org/downloads/#pil

Re: Rus Python script interactively

2009-07-18 Thread Marcus Wanner
On 7/18/2009 12:32 PM, Gnarlodious wrote: In an interactive session (I am using iPython), what is the most elegant way to run a Python script from Terminal? Right now I am saying: import subprocess subprocess.call(python /path/to/scriptname.py, shell=True) But I am calling a shell process and