Re: basic threading question

2007-10-30 Thread chris . monsanto
On Oct 30, 7:58 pm, "bambam" <[EMAIL PROTECTED]> wrote: > Are function variables thread safe? > > def f(a): > # whatever > return float(a) > > Is that OK? > > def f(a): > #whatever > b=a: > #whatever: > return float(b) > > Is that OK? > > Steve. Huh? -- http://mail.python

Re: Problem with regexp and text injection

2007-10-21 Thread chris . monsanto
On Oct 21, 6:22 pm, Panagiotis Atmatzidis <[EMAIL PROTECTED]> wrote: > Hello, > > I want to create a script in python that search for .html files in the > predefined directory and subdirectories. Then it checks if a specific > snippet of code exists in the .html file, if not it injects/adds the > c

Re: unicodedata implementation - categories

2007-10-13 Thread chris . monsanto
On Oct 13, 4:32 pm, James Abley <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to understand how CPython implements unicodedata, with a view to > providing an implementation for Jython. This is a background, low priority > thing for me, since I last posted to this list about it in February! > > Py

Re: if then elif

2007-10-10 Thread chris . monsanto
On Oct 10, 5:03 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > Shawn Minisall wrote: > > I just learned about if, then elif statements and wrote this program. > > The problem is, it's displaying all of the possibilities even after you > > enter a 0, or if the fat grams are more then the total number

Re: Top Programming Languages of 2013

2007-10-07 Thread chris . monsanto
On Oct 7, 11:54 am, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Kay Schluehr wrote: > > On Oct 7, 8:05 am, Dick Moores <[EMAIL PROTECTED]> wrote: > >> > > >> Dick Moores > > > Despite my doubts that Ajax and .NET will be programming languages in

Re: novice list

2007-10-05 Thread chris . monsanto
On Oct 5, 10:22 am, Paul Rudin <[EMAIL PROTECTED]> wrote: > István <[EMAIL PROTECTED]> writes: > > Could somebody suggest me a novice Python list, please? > > Here you go: > > ['novice'] > > (Sorry, couldn't resist.) No no... I think he meant a "simple" list. Like, you know, a list novices can han

Re: remove list elements..

2007-10-05 Thread chris . monsanto
On Oct 5, 10:27 am, Abandoned <[EMAIL PROTECTED]> wrote: > Hi.. > I have a problem.. > list1=[11, 223, 334, 4223...] 1 million element > list2=[22,223,4223,2355...] 500.000 element > > I want to difference list1 to list2 but order very importent.. > > My result must be: > list3=[11,334,...] > > I d

Re: A question on python performance.

2007-09-26 Thread chris . monsanto
On Sep 26, 2:26 pm, "Joe Goldthwaite" <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I'm a developer who's been using python for a couple of years. I wrote a > fairly large application using it but I was learning the language at the > same time so it most of the code kind of sucks. > > I've learned

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-25 Thread chris . monsanto
On Sep 25, 1:35 pm, thebjorn <[EMAIL PROTECTED]> wrote: > On Sep 25, 10:53 am, Mark Summerfield <[EMAIL PROTECTED]> > wrote: > > > Hi, > > > Below is a PEP proposal for a sorteddict. It arises out of a > > discussion on this list that began a few weeks ago with the subject of > > "An ordered dictio

Re: Counting method calls

2007-09-21 Thread chris . monsanto
On Sep 21, 7:15 pm, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > Hi, I know I'm being dumb but, why does it not work? > > >>> class MyList(list): > > ... def __init__(self): > ... self.calls = 0 > ... def __getattr__(self, name): > ... self.calls += 1 > ... return list

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread chris . monsanto
On Sep 21, 6:07 pm, Cristian <[EMAIL PROTECTED]> wrote: > On Sep 21, 2:48 pm, [EMAIL PROTECTED] wrote: > > > > > There are already anonymous functions in Python. > > > lambda x, y, z: x + y + z > > > is the same as: > > > def _(x, y, z): return x + y + z > > > As for the method stuff, check out sta

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-21 Thread chris . monsanto
On Sep 21, 5:37 pm, Cristian <[EMAIL PROTECTED]> wrote: > A friend of mine is an engineer and he's been needing to do more and > more programming as he goes on with is career. I convinced him to > learn Python instead of Perl and he's really started to like it. He > usually comes to me when he can'

Re: newb: Simple regex problem headache

2007-09-21 Thread chris . monsanto
On Sep 21, 5:04 pm, crybaby <[EMAIL PROTECTED]> wrote: > import re > > s1 =' 25000 ' > s2 = ' 5.5910 ' > > mypat = re.compile('[0-9]*(\.[0-9]*|$)') > rate= mypat.search(s1) > print rate.group() > > rate=mypat.search(s2) > print rate.group() > rate = mypat.search(s1) > price = float(rate.group()) >

Re: RE Help

2007-09-21 Thread chris . monsanto
On Sep 21, 4:09 pm, Thomas Jollans <[EMAIL PROTECTED]> wrote: > On Friday 21 September 2007, [EMAIL PROTECTED] wrote: > > > Not specific to Python, but it will be implemented in it... how do I > > compile a RE to catch everything between two know values? Here's what > > I've tried (but failed) to a

Re: RE Help

2007-09-21 Thread chris . monsanto
On Sep 21, 3:32 pm, [EMAIL PROTECTED] wrote: > > You'll want to use a non-greedy match: > > x = re.compile(r"START(.*?)END", re.DOTALL) > > Otherwise the . will match END as well. > > On Sep 21, 3:23 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > > > Only if there's a later END in the string, in whi

Re: RE Help

2007-09-21 Thread chris . monsanto
On Sep 21, 2:44 pm, David <[EMAIL PROTECTED]> wrote: > > data = "asdfasgSTARTpruyerfghdfjENDhfawrgbqfgsfgsdfg" > > x = re.compile('START.END', re.DOTALL) > > This should work: > > x = re.compile('START(.*)END', re.DOTALL) You'll want to use a non-greedy match: x = re.compile(r"START(.*?)END", re.

Re: Tapping into the access of an int instance

2007-09-20 Thread chris . monsanto
On Sep 20, 1:21 pm, "Tor Erik Sønvisen" <[EMAIL PROTECTED]> wrote: > Hi, > > Does anyone know how to interrupt the lookup of an integer value? I > know I need to subclass int, since builtin types can't be altered > directly... > > Below is how far I've come... What I want is to tap into the access

mod_python performs several magnitudes slower than PHP?

2007-05-19 Thread chris . monsanto
Recently I've had to move my site to a new dedicated server running FreeBSD 6.1. After installing apache 2.0.59, python 2.4.4 and mod_python 3.3.1, I decided to bench a script in PHP vs one in Python. I found out that for some reason, my mod_python was performing extremely slow - magnitudes slower