Re: execute

2008-03-09 Thread Benjamin
On Mar 9, 4:22 pm, Gif <[EMAIL PROTECTED]> wrote: > i'm trying to execute a file without replacing the current process, > but after searching the help file, documentations and the web, i can't > a way of doing that. > > os.exec*() will close the current program. Have a look at the subprocess module

Re: __iter__ yield

2008-03-09 Thread George Sakkis
On Mar 9, 7:37 pm, Paul Hankin <[EMAIL PROTECTED]> wrote: > On Mar 9, 8:58 pm, duccio <[EMAIL PROTECTED]> wrote: > > > Someone knows if it's possible to make this __iter__ function with just > > one 'yield' intead of two? > > ... > > def __iter__(self): > > yield self #1 > >

Re: any chance regular expressions are cached?

2008-03-09 Thread Steven D'Aprano
On Mon, 10 Mar 2008 00:42:47 +, mh wrote: > I've got a bit of code in a function like this: > > s=re.sub(r'\n','\n'+spaces,s) > s=re.sub(r'^',spaces,s) > s=re.sub(r' *\n','\n',s) > s=re.sub(r' *$','',s) > s=re.sub(r'\n*$','',s) > > Is there any chance that these will be c

SV: SV: Changing the size of a Button

2008-03-09 Thread K Viltersten
>> What i wish to do is to affect the size >> of the button but not due to change of >> text but due to resize of the frame it >> resides in. > > This is done by the layout manager, too: > > import Tkinter as tk > > root = tk.Tk() > button = tk.Button(root, text="42") > button.pack(fill=tk.BOTH,

Re: Import - interpreter works but .py import does not

2008-03-09 Thread John Machin
On Mar 10, 1:59 pm, John Boy <[EMAIL PROTECTED]> wrote: > First post and very much a newbie to Python. Have 2.5 on Linux (GG). I > think I have set up PYTHONPATH correctly in that I can import a module > apply_bp and it complains about line 20 in apply_bp which is: > > import sys, aipy, numpy, os

BitVector

2008-03-09 Thread DanielJohnson
Hi, I am trying to solve a genetic algorithm problem where I want to read a bitvector of very large size (say 1) and manipulate bits based on certain algorithms. I am a newbie in Python. What data structure are good to read such huge data set. Are there any built in classes for bit fiddling.

dot() and tensordot()

2008-03-09 Thread royG
hi can numpy.dot() be used instead of tensordot()? is there any performance difference? I am talking about operation btw numpy arrays of dimensions 50 X 20,000 where elements are of float type. i tried posting in numpy group where i had gotten membership..but when i post a msg it says posting by n

Re: any chance regular expressions are cached?

2008-03-09 Thread John Machin
On Mar 10, 11:42 am, [EMAIL PROTECTED] wrote: > I've got a bit of code in a function like this: > > s=re.sub(r'\n','\n'+spaces,s) > s=re.sub(r'^',spaces,s) > s=re.sub(r' *\n','\n',s) > s=re.sub(r' *$','',s) > s=re.sub(r'\n*$','',s) > > Is there any chance that these will be cach

Re: Checking if a variable is a dictionary

2008-03-09 Thread Gabriel Genellina
On 9 mar, 11:23, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sun, 09 Mar 2008 06:58:15 -0700, Guillermo wrote: > > Okay, so I think I know where's the catch now -- you must rely on the > > fact that the protocol is implemented, there's no way to enforce it if > > you're expec

Re: BitVector

2008-03-09 Thread Gabriel Genellina
On 10 mar, 01:26, DanielJohnson <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to solve a genetic algorithm problem where I want to read > a bitvector of very large size (say 1) and manipulate bits based > on certain algorithms. > > I am a newbie in Python. What data structure are good to rea

Re: What c.l.py's opinions about Soft Exception?

2008-03-09 Thread John Nagle
Steven D'Aprano wrote: > On Sat, 08 Mar 2008 22:24:36 -0800, Kay Schluehr wrote: > >> On 9 Mrz., 06:30, Steven D'Aprano <[EMAIL PROTECTED] >> cybersource.com.au> wrote: >> Is it really so exotic that it requires the demand for more use cases? > > > Are the existing solutions really so incomplet

Re: Returning values from function to Python shell/IPython

2008-03-09 Thread Gabriel Genellina
On 9 mar, 20:51, [EMAIL PROTECTED] wrote: > While you're at it, can you call up prior source, and edit it?  BASIC > had line numbers: > > 10 def f( a ): > 20   return a+ 1 > > >>> 15 print( a ) Not so easy. The current CPython implementation assumes that once an object is allocated, it is never m

How to factor using Python?

2008-03-09 Thread Nathan Pinno
How do I factor a number? I mean how do I translate x! into proper Python code, so that it will always do the correct math? Thanks in advance, Nathan P. -- http://mail.python.org/mailman/listinfo/python-list

Re: del class with recursive list

2008-03-09 Thread Gabriel Genellina
On 9 mar, 17:20, [EMAIL PROTECTED] wrote: > Thanks! I just need to remember to del the variables after "for in". And when working on the interactive interpreter, it's easy to forget the _ variable too (that holds the last printed expression) -- Gabriel Genellina -- http://mail.python.org/mailma

Re: gc question

2008-03-09 Thread Gabriel Genellina
On 9 mar, 15:37, I V <[EMAIL PROTECTED]> wrote: > On Sun, 09 Mar 2008 01:57:38 -0800, Vince wrote: > > Well, that suits me. The most unnatural thing about Python was adapting > > to the idea of just letting unreleased resources go jogging off > > wherever. :) > > Yes, that's a bad habit that garba

tcp client socket bind problem

2008-03-09 Thread natambu
I have a linux box with multiple ip addresses. I want to make my python client connect from one of the ip addresses. Here is my code, no matter what valid information I put in the bind it always comes from the default ip address on the server. Am I doing something wrong? - #!/usr/bin/

Re: Intelligent Date & Time parsing

2008-03-09 Thread castironpi
On Mar 8, 12:57 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > I am a GNU newbie.  (I know C &o.)  Can you point me to a > > place to find the source for 'date'? > > It's part of the GNU Coreutils: > > http://ftp.gnu.org/gnu/coreutils/ > > Within the file, you're likely interested in lib/getdate.* >

Re: How to factor using Python?

2008-03-09 Thread Gabriel Genellina
On 10 mar, 02:08, Nathan Pinno <[EMAIL PROTECTED]> wrote: > How do I factor a number? I mean how do I translate x! into proper > Python code, so that it will always do the correct math? Do you want to compute x! (factorial of x)? That is, you want a program that given a 4, returns 24? Think how w

Re: Distributed App - C++ with Python for Portability?

2008-03-09 Thread Paddy
On Mar 9, 11:41 pm, Roopan <[EMAIL PROTECTED]> wrote: > Hello! > > I am looking at developing an enterprise-grade distributed data > sharing application - key requirements are productivity and platform > portability. > > Will it be sensible to use C++ for performance-critical sections and > Python

image matching algorithms

2008-03-09 Thread Daniel Fetchinson
Hi all, There are a number of free tools for image matching but it's not very easy to decipher the actual algorithm from the code that includes db management, GUI, etc, etc. I have my own image database and GUI so all I need is the actual algorithm preferably in pseudo code and not in the form of

Re: BitVector

2008-03-09 Thread castironpi
> > I am trying to solve a genetic algorithm problem where I want to read > > a bitvector of very large size (say 1) and manipulate bits based > > on certain algorithms. Here's one on the Python website: http://search.live.com/results.aspx?q=python+bitvector&src=IE-SearchBox => http://pypi.pyt

Re: image matching algorithms

2008-03-09 Thread castironpi
On Mar 10, 1:32 am, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > Hi all, > > There are a number of free tools for image matching but it's not very > easy to decipher the actual algorithm from the code that includes db > management, GUI, etc, etc. I have my own image database and GUI so all > I

<    1   2