Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Fredrik Lundh
Jasper wrote: Having used Python for some 15 years, I'm hardly a neophyte -- it's pure serendipity that this hasn't bitten me before. Using languages and spending time reflecting over how they're put together are two very different things. -- http://mail.python.org/mailman/listinfo/python

Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Fredrik Lundh
Steven D'Aprano wrote: It doesn't help that the solution to get the expected behavior involves adding boiler-plate code all over. Expected by who? Blub programmers. -- http://mail.python.org/mailman/listinfo/python-list

Finding multiple of a decimal number in a floating point list

2008-08-18 Thread Alejandro
Hi: I need to find the multiples of a decimal number in a floating point list. For instance, if a have the list [0,0.01,0.02,...1], I want the multiples of 0.2: [0, 0.2,0.4,0.6,0.8,1]. With integers this problem is easy, just test for (i%n == 0), where i is the number I am testing, and n is the m

Re: auto-complete in html form input

2008-08-18 Thread Fredrik Lundh
JustWant2Ask JustWant2Ask wrote: I am trying to write a data filtering routine based on the input received from a html form as follows: myFilter=(((var1>=1) and (var1<=5)) or (var2==10)) and not(var3) Is there any way of auto-completing the variables (var1, var2 and var3 in the example above

Re: Weird expression result

2008-08-18 Thread Dan Lenski
On Mon, 18 Aug 2008 18:27:53 +0200, Peter Otten wrote: > Dan Lenski wrote: >> How does this play with standard precedence rules? > > Simple, all comparisons have the same priority: > > http://docs.python.org/ref/comparisons.html > > Peter I see. So, since the comparison operators have lower p

Re: configuring temporary entry widget of TableList Cell using Python

2008-08-18 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: It is this procedure I am trying to replicate in Python. Is it possible to guide help tell me the right approach here. Of course I can submit my code to help ( if this is useful ) but the problem I think clear to see from these summary details. I'm afraid this is a bit

Re: Finding multiple of a decimal number in a floating point list

2008-08-18 Thread Dan Lenski
On Mon, 18 Aug 2008 10:52:45 -0700, Alejandro wrote: > Hi: > > I need to find the multiples of a decimal number in a floating point > list. For instance, if a have the list [0,0.01,0.02,...1], I want the > multiples of 0.2: [0, 0.2,0.4,0.6,0.8,1]. > > With integers this problem is easy, just tes

Re: Finding multiple of a decimal number in a floating point list

2008-08-18 Thread Dan Lenski
On Mon, 18 Aug 2008 18:04:53 +, Dan Lenski wrote: > On Mon, 18 Aug 2008 10:52:45 -0700, Alejandro wrote: > >> Hi: >> >> I need to find the multiples of a decimal number in a floating point >> list. For instance, if a have the list [0,0.01,0.02,...1], I want the >> multiples of 0.2: [0, 0.2,0

Re: Bizarre method keyword-arg bug.

2008-08-18 Thread Fredrik Lundh
Robert Brown wrote: You may find the above surprising, but Common Lisp users expect the default argument expression to be evaluated anew when need by a function call: I find the Lisp approach more reasonable. Also, an argument based on performance for Python's current behavior seems dubious,

Re: Newbie problem inserting into MySQL

2008-08-18 Thread Edwin . Madari
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > ython.org] > On Behalf Of len > Sent: Monday, August 18, 2008 11:55 AM > To: python-list@python.org > Subject: Newbie problem inserting into MySQL > > > Hi All > > I have started a little pet project to learn py

Re: How to delete a line with re?

2008-08-18 Thread John Machin
On Aug 18, 10:56 pm, [EMAIL PROTECTED] wrote: > running this snippet, is blanking out ^abdc$.. what is the issue ? > abcd > efg > hijk > lmn > $ > > efg > hijk > lmn > The OP said he wanted to delete the line with abc [sic]. He showed no interest in "blanking out ^abdc$. [sic]". The given snippet

Re: configuring temporary entry widget of TableList Cell using Python

2008-08-18 Thread lee . walczak
On Aug 18, 7:01 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > It is this procedure I am trying to replicate in Python. Is it > > possible to guide help tell me the right approach here. Of course I > > can submit my code to help ( if this is useful ) but the problem I >

Re: Newbie problem inserting into MySQL

2008-08-18 Thread Edwin . Madari
> -Original Message- > From: Madari, Edwin > Sent: Monday, August 18, 2008 3:03 PM > To: 'len'; python-list@python.org > Subject: Re: Newbie problem inserting into MySQL > > > -Original Message- > > From: > [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] > > yt

Re: Newbie problem inserting into MySQL

2008-08-18 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: another thing - cumulative inserts will result, since > listofrec is not emptied after each sql execution. isn't that the point? -- he's building an argument array, and passing it to executemany after it's reached a given size. (to the OP, a quick code review doesn'

Re: handling Struct and global function for C module

2008-08-18 Thread Fredrik Lundh
Anish Chapagain wrote: but while running setup.py build with distutils it's showing error as _ex.o: In function 'init_arguments': _ex.c :89: undefined reference to _TLM_read_model _ex.c :95: undefined reference to _TLM_set_tag for all the global function declared within .h file and

Re: like a "for loop" for a string

2008-08-18 Thread bearophileHUGS
Fredrik Lundh: > or you could use re.finditer, which can be used for a lot more than just > splitting. Having implemented some of them (and even invented algorithms like a new substring search, that I have appreciated) you know that string methods are simpler ways to efficiently perform specialize

Setting urllib2 what IP to use

2008-08-18 Thread Alexandru Palade
Hi, I have an interface (let's say eth0) which has more than one IP. Is there any way I can choose - from a parameter or something - what ip to use? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: handling Struct and global function for C module

2008-08-18 Thread Anish Chapagain
On Aug 18, 8:43 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Anish Chapagain wrote: > > but while running setup.py build with distutils it's showing error as > > > _ex.o: In function 'init_arguments': > >      _ex.c :89: undefined reference to _TLM_read_model > >      _ex.c :95:  undefined refere

Re: Newbie problem inserting into MySQL

2008-08-18 Thread John Machin
On Aug 19, 1:54 am, len <[EMAIL PROTECTED]> wrote: > | lottryid | int(11) | NO | PRI | NULL| > auto_increment | > tupcnt += 1 > rectuple = tupcnt, thekey, a, b, c, d, e, mysum, 0 > listofrec.append(rectuple) >

Re: Newbie problem inserting into MySQL

2008-08-18 Thread Peter Otten
len wrote: > I have started a little pet project to learn python and MySQL. The > project involves figuring out all the combinations for a 5 number > lottery and storing the data in a MySQL file. > import MySQLdb > cursor.executemany('''insert into > littlelottery >

searching through a string and pulling characters

2008-08-18 Thread Alexnb
This is similar to my last post, but a little different. Here is what I would like to do. Lets say I have a text file. The contents look like this, only there is A LOT of the same thing. () A registry mark given by underwriters (as at Lloyd's) to ships in first-class condition. Inferior grades

Re: HTML Tables

2008-08-18 Thread Gabriel Genellina
En Mon, 18 Aug 2008 09:05:30 -0300, Adrian Smith <[EMAIL PROTECTED]> escribió: > On Aug 18, 7:16 pm, Amie <[EMAIL PROTECTED]> wrote: >> Afternoon all. >> >> Just want to know how to create html tables using a for loop. >> I need to display 34 html tables, so I figured a for loop will do. >> Please

Re: searching through a string and pulling characters

2008-08-18 Thread Wojtek Walczak
On Mon, 18 Aug 2008 13:40:13 -0700 (PDT), Alexnb wrote: > Now, I am talking 1000's of these. I need to do something like this. I will > have a number, and what I want to do is go through this text file, just like > the example. The trick is this, those "()'s" are what I need to match, so if > the n

Re: HTML Tables

2008-08-18 Thread Fredrik Lundh
Adrian Smith wrote: Just want to know how to create html tables using a for loop. I need to display 34 html tables, so I figured a for loop will do. Please show me an example of how to do that. for i in range(33): range(33) returns 33 numbers, not 34 (the upper bound is not inclusive).

Re: searching through a string and pulling characters

2008-08-18 Thread nntpman68
Hi, Is it thousands of lines or millions of lines? If it's just a few thousands and you're not working on an embedded device with little memory you could use the brute force approach Just read the whole file in one string vaiable split everything into an array separated by '()' Now you can

Re: searching through a string and pulling characters

2008-08-18 Thread Gabriel Genellina
En Mon, 18 Aug 2008 17:40:13 -0300, Alexnb <[EMAIL PROTECTED]> escribió: > Lets say I have a text file. The contents look like this, only there is A > LOT of the same thing. > > () A registry mark given by underwriters (as at Lloyd's) to ships in > first-class condition. Inferior grades are indica

Re: searching through a string and pulling characters

2008-08-18 Thread Wojtek Walczak
On Mon, 18 Aug 2008 21:43:43 + (UTC), Wojtek Walczak wrote: > On Mon, 18 Aug 2008 13:40:13 -0700 (PDT), Alexnb wrote: >> Now, I am talking 1000's of these. I need to do something like this. I will >> have a number, and what I want to do is go through this text file, just like >> the example. Th

Python encoding

2008-08-18 Thread Joan Pallarès
I have problems encoding some team names. Python can't work with: ª, é, ç. I tried to create unicode in this two ways: self.nombreLocal = unicode(nombreLocal) self.nombreLocal = unicode(nombreLocal, 'iso-8859-1') But there is always one character that can't be encoded!! unicode doesn`t enco

Re: searching through a string and pulling characters

2008-08-18 Thread John Machin
On Aug 19, 6:40 am, Alexnb <[EMAIL PROTECTED]> wrote: > This is similar to my last post, Oh, goodie goodie goodie, I love guessing games! > but a little different. Here is what I would > like to do. > > Lets say I have a text file. The contents look like this, only there is A > LOT of the same th

Re: Python encoding

2008-08-18 Thread Fredrik Lundh
Joan Pallarès wrote: I tried to create unicode in this two ways: self.nombreLocal = unicode(nombreLocal) self.nombreLocal = unicode(nombreLocal, 'iso-8859-1') the "unicode" constructor takes a string of bytes in some known character encoding, and decodes them into a Unicode string. if you

Re: Programming Languages Decisions

2008-08-18 Thread Terry Reedy
This report is intended for any computer programming experts who would like to propose that their favorite programming language is the one that should be used for the potentially important application that is being discussed here. I believe more scientists are happy programming in Pytho

Re: searching through a string and pulling characters

2008-08-18 Thread Alexnb
Okay, well the point of this program is to steal from the OS X built-in dictionary. While most of the files are hidden this one is not. The "()" You saw actually looks like this: ([I][/I]) only the []'s are <'s and >'s but the forum doesn't take kindly to html. What you saw was exactly how it wi

Re: searching through a string and pulling characters

2008-08-18 Thread John Machin
On Aug 19, 8:34 am, Alexnb <[EMAIL PROTECTED]> wrote: > The number is based on the word(s) they type into my program, and then it > fetches the number that word is in the list of words and then will search > the definitions document and go to the nth def. It probably won't work, but > that is the

Re: searching through a string and pulling characters

2008-08-18 Thread Steven D'Aprano
On Mon, 18 Aug 2008 13:40:13 -0700, Alexnb wrote: > Lets say I have a text file. The contents look like this, only there is > A LOT of the same thing. > > () A registry mark given by underwriters (as at Lloyd's) to ships in > first-class condition. Inferior grades are indicated by A 2 and A 3. ()

Re: searching through a string and pulling characters

2008-08-18 Thread John Machin
On Aug 19, 8:34 am, Alexnb <[EMAIL PROTECTED]> wrote: > > The number is based on the word(s) they type into my program, and then it > fetches the number that word is in the list of words and then will search > the definitions document and go to the nth def. It probably won't work, but > that is the

Re: searching through a string and pulling characters

2008-08-18 Thread Alexnb
If by "What happened when you did:" you mean dictionary.com and yourdictionary.com? Nothing, they work but screen scraping isn't medicore at best. They both work fine (yourdictionary is better for screen scraping) but. I want maybe an offline soloution. But the whole reason for the program is that

Re: searching through a string and pulling characters

2008-08-18 Thread Steven D'Aprano
On Mon, 18 Aug 2008 15:34:12 -0700, Alexnb wrote: > Okay, well the point of this program is to steal from the OS X built-in > dictionary. Ah, not homework, but copyright infringement. > Also, on a side-note, does anyone know a very simple dictionary site, > that isn't dictionary.com or yourdicti

Re: Programming Languages Decisions

2008-08-18 Thread John Machin
On Aug 18, 10:59 pm, "E.D.G." <[EMAIL PROTECTED]> wrote: > >If all goes according to plan, within a few weeks I will begin > circulating .exe copies of a Perl language disaster mitigation related > computer program that I have been developing during the past decade or so. A computer progra

Re: HTML Tables

2008-08-18 Thread Adrian Smith
On Aug 19, 6:49 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Adrian Smith wrote: > >> Just want to know how to create html tables using a for loop. > >> I need to display 34 html tables, so I figured a for loop will do. > >> Please show me an example of how to do that. > > > for i in range(33): >

Re: cross-compilation

2008-08-18 Thread Roumen Petrov
Martin v. Löwis wrote: What about to start to resolve issues step by step ? The first step surely should be to get the autoconf issue resolved. I don't think distutils cross-compilation is going to work, instead, people wishing to cross-compile should edit Modules/Setup. Regards, Martin Ple

Roundup Issue Tracker version 1.4.5.1 released

2008-08-18 Thread Richard Jones
I'm proud to release version 1.4.5 of Roundup. 1.4.5.1 has one new feature: - Add use of username/password stored in ~/.netrc in mailgw (sf patch #1912105) It is otherwise mostly a bugfix release: - 'Make a Copy' failed with more than one person in nosy list (sf #1906147) - xml-rpc security c

Re: help with parsing email

2008-08-18 Thread Gabriel Genellina
En Mon, 18 Aug 2008 12:24:07 -0300, Ahmed, Shakir <[EMAIL PROTECTED]> escribió: > Thanks everyone who tried to help me to parse incoming email from an exchange > server: > > Now, I am getting following error; I am not sure where I am doing wrong. I > appreciate any help how to resolve this error

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Asun Friere
On Aug 19, 2:37 am, "Stephen Cattaneo" <[EMAIL PROTECTED]> wrote: > - What did you run in the cronjob to get back all those variables? > > set; echo "-"; echo "import os; print > os.environ" | python > > Cheers, > > S As I should have noted from $BASH_EXECUTION_STRING. I'd be hal

Re: help with parsing email

2008-08-18 Thread Gabriel Genellina
En Mon, 18 Aug 2008 12:24:07 -0300, Ahmed, Shakir <[EMAIL PROTECTED]> escribió: > Thanks everyone who tried to help me to parse incoming email from an exchange > server: > > Now, I am getting following error; I am not sure where I am doing wrong. I > appreciate any help how to resolve this error

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Asun Friere
On Aug 18, 11:17 pm, "Shawn Milochik" <[EMAIL PROTECTED]> wrote: > > The easiest solution (in my opinion) is to write a bash script to > execute your Python script, and use that bash script to add those > environment variables. Agreed. Wrap it in a shell script, easier to read and grow than a on

Re: list/tuple/dict question

2008-08-18 Thread Gabriel Genellina
En Mon, 18 Aug 2008 11:02:20 -0300, gundlach <[EMAIL PROTECTED]> escribió: > In C or C++, what you want to do is impossible. However, in Python, > there's a way to specify the name of a local variable at runtime: > > locals()['cat'] = [] > > locals() is a function call that returns a dictionary m

Re: Getting pid of a remote process

2008-08-18 Thread srinivasan srinivas
HI, I am using Solaris and subprocess.Popen to spawn a process on a remote machine. Thanks, Srini - Original Message From: Diez B. Roggisch <[EMAIL PROTECTED]> To: python-list@python.org Sent: Monday, 18 August, 2008 9:23:20 PM Subject: Re: Getting pid of a remote process srinivasan sr

Re: Newbie problem inserting into MySQL

2008-08-18 Thread John Nagle
len wrote: I have started a little pet project to learn python and MySQL. The project involves figuring out all the combinations for a 5 number lottery and storing the data in a MySQL file. 1. As someone else mentioned, the placeholder for MySQL data is "%s", not "?". 2. After

Python Query: Related to locking a resource in a multithreaded environment

2008-08-18 Thread tarun
Hello All, I've a configuration.ini file. This particular can be accessed by several threads of my application. Each thread can read/write configuration parameters from/to the configuration.ini file. I am using threading (Rlock) to lock the resource (configuration.ini file) while accessing it from

Re: Python Query: Related to locking a resource in a multithreaded environment

2008-08-18 Thread Timothy Grant
On Mon, Aug 18, 2008 at 10:58 PM, tarun <[EMAIL PROTECTED]> wrote: > Hello All, > > I've a configuration.ini file. This particular can be accessed by several > threads of my application. Each thread can read/write configuration > parameters from/to the configuration.ini file. I am using threading (

Re: Python Query: Related to locking a resource in a multithreaded environment

2008-08-18 Thread tarun
I think I need something called global interpreter lock which is accessible to all the threads. But I am not sure how to implement this. On Tue, Aug 19, 2008 at 11:28 AM, tarun <[EMAIL PROTECTED]> wrote: > Hello All, > > I've a configuration.ini file. This particular can be accessed by several

Python Substitute for PHP GD, Resizing an image on the client side

2008-08-18 Thread brahmaforces
Hi Folks, I am using cherrypy and python. I am trying to get a user profile image to resize on the client side before uploading to the server. PHP has a gd library that does it it seems. Has anyone done this in a python environment without uploading to the server? -- http://mail.python.org/mailman

Re: Python Substitute for PHP GD, Resizing an image on the client side

2008-08-18 Thread Uwe Schmitt
On 19 Aug., 08:32, brahmaforces <[EMAIL PROTECTED]> wrote: > Hi Folks, > > I am using cherrypy and python. I am trying to get a user profile > image to resize on the client side before uploading to the server. PHP > has a gd library that does it it seems. php works on the client side ?? are you su

Re: Python Substitute for PHP GD, Resizing an image on the client side

2008-08-18 Thread Rob Weir
On 19 Aug 2008, [EMAIL PROTECTED] wrote: > Hi Folks, > > I am using cherrypy and python. I am trying to get a user profile > image to resize on the client side before uploading to the server. PHP > has a gd library that does it it seems. PIL? http://www.pythonware.com/products/pil/. -- -rob -

Re: Programming Languages Decisions

2008-08-18 Thread E.D.G.
"Terry Reedy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Rather than explain further, I suggest that you visit python.org and read some of the tutorial to see what *you* think. http://docs.python.org/tut/tut.html My original programs were mostly in Basic. When it became obvio

Re: Programming Languages Decisions

2008-08-18 Thread E.D.G.
"John Machin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] language disaster was to avoid using that language altogether. It has been okay for getting my application up and running. And now that it is running people who will be using the application will have to decide if they

Re: Python Substitute for PHP GD, Resizing an image on the client side

2008-08-18 Thread Diez B. Roggisch
brahmaforces schrieb: Hi Folks, I am using cherrypy and python. I am trying to get a user profile image to resize on the client side before uploading to the server. PHP has a gd library that does it it seems. Has anyone done this in a python environment without uploading to the server? Everyth

<    1   2