Re: [SPAM] Re: Threaded alternatives to smtplib?

2009-05-04 Thread MRAB
Diez B. Roggisch wrote: Alex Jurkiewicz schrieb: Hi all, I'm writing a Python script to do a "mail merge" style email distribution. I create a few python threads and in each one I call `smtpserver = smtplib.SMTP(our.smtpserver.com)`. However, during the sending process, there seems to be only

Re: replacing numbers in LARGE MATRIX with criterium in 2 columns (a--> b)

2009-05-04 Thread MRAB
Alexzive wrote: Hello, I have this matrix [20*4 - but it could be n*4 , with n~100,000] in file "EL_list" like this: 1, 1, 2, 3 2, 4, 1, 5 3, 5, 1, 6 4, 7, 5, 6 5, 8, 7, 9 6, 8, 5,

Re: How to walk up parent directories?

2009-05-04 Thread Diez B. Roggisch
Snorri H wrote: > On May 4, 5:04 am, Matthew Wilson wrote: >> Is there already a tool in the standard library to let me walk up from a >> subdirectory to the top of my file system? > > > Never seen such a standard tool, yet it can be implemented in a way > like this > > def walkup(path): >

Re: Re: replacing numbers in LARGE MATRIX with criterium in 2 columns (a--> b)

2009-05-04 Thread Dave Angel
Alessandro wrote: On May 4, 2:38 pm, Alexzive wrote: Hello, I have this matrix [20*4 - but it could be n*4 , with n~100,000] in file "EL_list" like this: 1, 1, 2, 3 2, 4, 1, 5 3, 5, 1, 6 4, 7, 5, 6 5,

Re: Multiprocessing.Queue - I want to end.

2009-05-04 Thread Luis Zarrabeitia
On Monday 04 May 2009 04:01:23 am Hendrik van Rooyen wrote: > This will form a virtual (or real if you have different machines) > systolic array with producers feeding consumers that feed > the summary process, all running concurrently. Nah, I can't do that. The summary process is expensive, but

Default padding for Tkinter grid

2009-05-04 Thread Amr
Hello all, I've been spending the last few days experimenting with Tkinter. The grid manager is nice and easy to use, but I have found that I am often having to specify padx and pady options to every widget I add to my grid. The way I am doing it is to create a dictionary: paddding = {'padx': '1m

Help in getting the IP address of client machines

2009-05-04 Thread M Kumar
Hi, I am using pylons web framework for my server. I need to get the ip address of the client machine which made a request to the server in my python code. How can I do that, I am new to pylons and the existing server has so many applications. looking forward to get some solutions from the kind fr

Re: find sublist inside list

2009-05-04 Thread Francesco Guerrieri
On Mon, May 4, 2009 at 3:01 PM, John O'Hagan wrote: > On Mon, 4 May 2009, Matthias Gallé wrote: > > Hi. > > > > My problem is to replace all occurrences of a sublist with a new element. > > > > Example: > > Given ['a','c','a','c','c','g','a','c'] I want to replace all > > occurrences of ['a','c']

Re: find sublist inside list

2009-05-04 Thread John O'Hagan
On Mon, 4 May 2009, Matthias Gallé wrote: > Hi. > > My problem is to replace all occurrences of a sublist with a new element. > > Example: > Given ['a','c','a','c','c','g','a','c'] I want to replace all > occurrences of ['a','c'] by 6 (result [6,6,'c','g',6]). > li=['a', 'c', 'a', 'c', 'c', 'g', '

Re: find sublist inside list

2009-05-04 Thread bearophileHUGS
Matthias Gallé: > My problem is to replace all occurrences of a sublist with a new element. > Example: > Given ['a','c','a','c','c','g','a','c'] I want to replace all > occurrences of ['a','c'] by 6 (result [6,6,'c','g',6]). There are several ways to solve this problem. Representing a string as a

Re: replacing numbers in LARGE MATRIX with criterium in 2 columns (a--> b)

2009-05-04 Thread Alessandro
On May 4, 2:38 pm, Alexzive wrote: > Hello, > I have this matrix [20*4 - but it could be n*4 , with n~100,000] in > file "EL_list" like this: > > 1, 1, 2, 3 > 2, 4, 1, 5 > 3, 5, 1, 6 > 4, 7, 5, 6 > 5, 8,

replacing numbers in LARGE MATRIX with criterium in 2 columns (a--> b)

2009-05-04 Thread Alexzive
Hello, I have this matrix [20*4 - but it could be n*4 , with n~100,000] in file "EL_list" like this: 1, 1, 2, 3 2, 4, 1, 5 3, 5, 1, 6 4, 7, 5, 6 5, 8, 7, 9 6, 8, 5, 7 7,

Re: Self function

2009-05-04 Thread BJörn Lindqvist
2009/5/4 : > An idea-syntax: > > def fact(n): >    return 1 if n <= 1 else n * inspect.self(n - 1) > > Or even a lambda, because you don't need the name anymore to call the > function: > > fact = lambda n: 1 if n <= 1 else n * self(n - 1) How would it work with methods? class Foo: def fac(se

find sublist inside list

2009-05-04 Thread Matthias Gallé
Hi. My problem is to replace all occurrences of a sublist with a new element. Example: Given ['a','c','a','c','c','g','a','c'] I want to replace all occurrences of ['a','c'] by 6 (result [6,6,'c','g',6]). If I do this with string ('acaccgac') I have the advantage of all the 'find' functions,

Re: What IDE support python 3.0.1 ?

2009-05-04 Thread Mark
On Wed, 15 Apr 2009 22:45:35 +, Benjamin Peterson wrote: > Why do you think you're wasting time with 2.x? I'm a relative newbie to python as well but I'd agree that there is at least a small degree of time "wasted" learning python 2.x simply because the standard library of python 3.x has been

Re: How to walk up parent directories?

2009-05-04 Thread Snorri H
On May 4, 5:04 am, Matthew Wilson wrote: > Is there already a tool in the standard library to let me walk up from a > subdirectory to the top of my file system? Never seen such a standard tool, yet it can be implemented in a way like this def walkup(path): aux = path.rsplit('/') while a

Re: yet another list comprehension question

2009-05-04 Thread David Robinow
On Mon, May 4, 2009 at 2:33 AM, namekuseijin wrote: ls = [(1,2), (3,4), (5, None), (6,7), (8, None)] [(x,y) for (x,y) in ls if y] > [(1, 2), (3, 4), (6, 7)] Nope. That filters out 0 as well as None. Not what the OP asked for. -- http://mail.python.org/mailman/listinfo/python-list

Re: yet another list comprehension question

2009-05-04 Thread Arnaud Delobelle
Snorri H writes: > On May 3, 6:13 am, Ross wrote: >> I'm trying to set up a simple filter using a list comprehension. If I >> have a list of tuples, a = [(1,2), (3,4), (5,None), (6,7), (8, None)] >> and I wanted to filter out all tuples containing None, I would like to >> get the new list b = [(

Re: yet another list comprehension question

2009-05-04 Thread Snorri H
On May 3, 6:13 am, Ross wrote: > I'm trying to set up a simple filter using a list comprehension. If I > have a list of tuples, a = [(1,2), (3,4), (5,None), (6,7), (8, None)] > and I wanted to filter out all tuples containing None, I would like to > get the new list b = [(1,2), (3,4),(6,7)]. > > I

Re: Threaded alternatives to smtplib?

2009-05-04 Thread Diez B. Roggisch
Diez B. Roggisch wrote: > Alex Jurkiewicz wrote: > >> Gabriel Genellina wrote: >>> Try logging the start/stop of your threads. It may be that your >>> threads stop before you think. The above code works correctly only if >>> you fill the queue before starting any thread - because as soon as a >>>

Re: Threaded alternatives to smtplib?

2009-05-04 Thread Diez B. Roggisch
Alex Jurkiewicz wrote: > Gabriel Genellina wrote: >> Try logging the start/stop of your threads. It may be that your >> threads stop before you think. The above code works correctly only if >> you fill the queue before starting any thread - because as soon as a >> thread sees the queue empty, it f

Re: Self function

2009-05-04 Thread bearophileHUGS
Arnaud Delobelle: > >>> def bindfunc(f): > ...     def boundf(*args, **kwargs): > ...         return f(boundf, *args, **kwargs) > ...     return boundf > ...>>> @bindfunc > ... def fac(self, n): > ...     return 1 if n <= 1 else n * self(n - 1) > ...>>> fac(5) > 120 This is cute, now I have two n

Re: Is it better to use threads or fork in the following case

2009-05-04 Thread Diez B. Roggisch
CTO wrote: >> In addition, the zip file format stores the directory at the end of the >> file. So you can't process it until it's completely downloaded. >> Concurrency doesn't help here. > > Don't think that's relevant, if I'm understanding the OP correctly. > Lets say you've downloaded the file

Re: Threaded alternatives to smtplib?

2009-05-04 Thread Alex Jurkiewicz
Gabriel Genellina wrote: Try logging the start/stop of your threads. It may be that your threads stop before you think. The above code works correctly only if you fill the queue before starting any thread - because as soon as a thread sees the queue empty, it finishes. You could use the sample

Re: Strange interaction between timeit and recursion

2009-05-04 Thread Hrvoje Niksic
Steven D'Aprano writes: > I don't understand why my recursive function hits the recursion > limit inside the timeit.Timer when it works outside of it. Probably because your test function is at the very edge of the recursion limit, and timeit.Timer triggers it because it calls it at a deeper stac

Re: Multiprocessing.Queue - I want to end.

2009-05-04 Thread Hendrik van Rooyen
"Luis Alberto Zarrabeitia Gomez" wrote: >Quoting Hendrik van Rooyen : >> In fact I happen to believe that anything that does any work needs >> one and only one input queue and nothing else, but I am peculiar >> that way. > >Well, I also need some output. In my case, the outputs are files with th

Re: Threaded alternatives to smtplib?

2009-05-04 Thread Gabriel Genellina
En Mon, 04 May 2009 04:19:21 -0300, Alex Jurkiewicz escribió: Diez B. Roggisch wrote: Without more code, it's impossible to tell if there is anything peculiar in your usage of the lib. Maybe you close your connections to fast to see several open? Here's the relevant stuff from my (python2

Re: Tkinter, Trouble with Message,Label widget

2009-05-04 Thread Hendrik van Rooyen
"norseman" wrote: > There has to be some way of using a Message or Label (or some) widget as > a simple posting board. There is - look at textvariable - an instance of StringVar that is associated with the widget. If all else fails, you can always use configure to change the text... hth - He

Re: Threaded alternatives to smtplib?

2009-05-04 Thread Alex Jurkiewicz
Diez B. Roggisch wrote: Without more code, it's impossible to tell if there is anything peculiar in your usage of the lib. Maybe you close your connections to fast to see several open? Here's the relevant stuff from my (python2.6) code: CONCURRENCY = 3 def threadProcessRecipient(): # Eac

Re: What IDE support python 3.0.1 ?

2009-05-04 Thread JussiJ
On Apr 16, 1:26 pm, Brendon Wickham wrote: > I agree, no IDE needed. Just don't use Notepad! I'm on Mac, so > spoiled for choice of text editors, but I'm sure there's one > or 2 good uns if you're on Windows. The Zeus for Windows IDE is Python aware: http://www.zeusedit.com/python.html It d

Re: python docs for beginner programmer?

2009-05-04 Thread Gabriel Genellina
En Sun, 03 May 2009 21:41:47 -0300, Deep_Feelings escribió: Do you think python online docs are good starting point for me? ( i experience with other programming languages ) or should i get giant book or something ? If you have some previous experience with other languages, I think that "

<    1   2