[ANN] regobj - Pythonic object-based access to the Windows Registry

2009-05-04 Thread Ryan Kelly
Hi All, I've just released the results of a nice Sunday's coding, inspired by one too many turns at futzing around with the _winreg module. The regobj module brings a convenient and clean object-based API for accessing the Windows Registry. http://pypi.python.org/pypi/regobj/ More

python-graph-1.5.0 released

2009-05-04 Thread Pedro Matiello
python-graph release 1.5.0 http://code.google.com/p/python-graph/ python-graph is a library for working with graphs in Python. This software provides a suitable data structure for representing graphs and a whole set

Python Training in Chicago - Last day to register

2009-05-04 Thread David Beazley
Python Training In Downtown Chicago May 11-15, 2009 http://www.dabeaz.com/chicago * * * Last Day to Register * * * Just a friendly reminder that there is still time to register

IMDbPY 4.1 and IMDbPYKit 1.1.1

2009-05-04 Thread Davide Alberani
IMDbPY 4.1 and IMDbPYKit 1.1.1 are available (tgz, deb, rpm, exe) from: http://imdbpy.sourceforge.net/ IMDbPY is a Python package useful to retrieve and manage the data of the IMDb movie database about movies, people, characters and companies. IMDbPYKit (mostly developed by H. Turgut Uyar) is a

Re: Using Help inside Python

2009-05-04 Thread namekuseijin
I'm from the time when I inspected python objects themselves, say: print obj.__doc__ or dir( obj ) to know the goodies... -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange interaction between timeit and recursion

2009-05-04 Thread namekuseijin
Recursion is unpythonic. Do not use it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange interaction between timeit and recursion

2009-05-04 Thread Chris Rebert
On Sun, May 3, 2009 at 11:27 PM, namekuseijin namekuseijin.nos...@gmail.com wrote: Recursion is unpythonic.  Do not use it. That's a tad extreme. I think the accepted practice is merely not to use recursion gratuitously. Cheers, Chris -- http://blog.rebertia.com --

Re: Self function

2009-05-04 Thread Steve Howell
On May 3, 5:21 pm, Emile van Sebille em...@fenx.com wrote: On 5/3/2009 3:39 PM bearophileh...@lycos.com said... Sometimes I rename recursive functions, or I duplicatemodify them, and they stop working because inside them there's one or more copy of their old name. This happens to me

Re: yet another list comprehension question

2009-05-04 Thread namekuseijin
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)] -- http://mail.python.org/mailman/listinfo/python-list

Re: Self function

2009-05-04 Thread Arnaud Delobelle
bearophileh...@lycos.com writes: Sometimes I rename recursive functions, or I duplicatemodify them, and they stop working because inside them there's one or more copy of their old name. This happens to me more than one time every year. So I have written this: from inspect import

Re: Self function

2009-05-04 Thread Chris Rebert
On Sun, May 3, 2009 at 11:29 PM, Arnaud Delobelle arno...@googlemail.com wrote: bearophileh...@lycos.com writes: Sometimes I rename recursive functions, or I duplicatemodify them, and they stop working because inside them there's one or more copy of their old name. This happens to me more

Re: Threaded alternatives to smtplib?

2009-05-04 Thread Diez B. Roggisch
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 one connection open to

Re: Strange interaction between timeit and recursion

2009-05-04 Thread Diez B. Roggisch
namekuseijin schrieb: Recursion is unpythonic. Do not use it. Since when? Says who? Lacking tail-recursion, it's not the choice for loops, but whatever algorithm is recursive can be written as such. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: python docs for beginner programmer?

2009-05-04 Thread Gabriel Genellina
En Sun, 03 May 2009 21:41:47 -0300, Deep_Feelings doctore...@gmail.com 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

Re: What IDE support python 3.0.1 ?

2009-05-04 Thread JussiJ
On Apr 16, 1:26 pm, Brendon Wickham brendon.wick...@gmail.com 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:

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(): #

Re: Tkinter, Trouble with Message,Label widget

2009-05-04 Thread Hendrik van Rooyen
norseman n...@hughes.net 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

Re: Threaded alternatives to smtplib?

2009-05-04 Thread Gabriel Genellina
En Mon, 04 May 2009 04:19:21 -0300, Alex Jurkiewicz a...@bluebottle.net.au 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

Re: Multiprocessing.Queue - I want to end.

2009-05-04 Thread Hendrik van Rooyen
Luis Alberto Zarrabeitia Gomez ky...@uh.cu wrote: Quoting Hendrik van Rooyen m...@microcorp.co.za: 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

Re: Strange interaction between timeit and recursion

2009-05-04 Thread Hrvoje Niksic
Steven D'Aprano st...@remove-this-cybersource.com.au 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

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: 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 names to take care

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 once and

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 finishes.

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 thread sees

Re: yet another list comprehension question

2009-05-04 Thread Arnaud Delobelle
Snorri H a.a.ovtchinni...@gmail.com writes: On May 3, 6:13 am, Ross ross.j...@gmail.com 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

Re: yet another list comprehension question

2009-05-04 Thread Snorri H
On May 3, 6:13 am, Ross ross.j...@gmail.com 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),

Re: yet another list comprehension question

2009-05-04 Thread David Robinow
On Mon, May 4, 2009 at 2:33 AM, namekuseijin namekuseijin.nos...@gmail.com 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. --

Re: How to walk up parent directories?

2009-05-04 Thread Snorri H
On May 4, 5:04 am, Matthew Wilson m...@tplus1.com 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 =

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

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'

Re: Self function

2009-05-04 Thread BJörn Lindqvist
2009/5/4 bearophileh...@lycos.com: 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:

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: replacing numbers in LARGE MATRIX with criterium in 2 columns (a-- b)

2009-05-04 Thread Alessandro
On May 4, 2:38 pm, Alexzive zasaconsult...@gmail.com 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: 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: 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', 'a',

Re: find sublist inside list

2009-05-04 Thread Francesco Guerrieri
On Mon, May 4, 2009 at 3:01 PM, John O'Hagan m...@johnohagan.com 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

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

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':

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: Code works fine except...

2009-05-04 Thread Ross
On May 3, 10:16 pm, John Yeung gallium.arsen...@gmail.com wrote: On May 3, 11:29 pm, Chris Rebert c...@rebertia.com wrote: Probably not the cause of the problem, but where did the magic numbers 1.072 and 1.08 come from? It is perhaps not the most direct cause of the problem, in the sense

Re: find sublist inside list

2009-05-04 Thread bearophileHUGS
Matthias Gallé: the int that can replace a sublist can be 255, You didn't specify your integer ranges. Probably there are many other solutions for your problem, but you have to give more information. Like the typical array size, typical range of the numbers, how much important is total memory

IDE for python 2.6 (auto complete)

2009-05-04 Thread Soumen banerjee
Hello, I have just installed and run python 2.6.2 from the sources available on the website. I notice that SPE (the editor which i used with python 2.5) is not displaying some of the functions new in 2.6 as autocomplete options. Is there any IDE with support for autocomplete in python 2.6 with all

Re: Default padding for Tkinter grid

2009-05-04 Thread Amr
On May 4, 3:57 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Mon, 04 May 2009 10:27:49 -0300, Amr amrbek...@gmail.com escribió: 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

Re: Self function

2009-05-04 Thread Steve Howell
On May 3, 3:39 pm, bearophileh...@lycos.com wrote: Sometimes I rename recursive functions, or I duplicatemodify them, and they stop working because inside them there's one or more copy of their old name. This happens to me more than one time every year. So I have written this: from inspect

Re: find sublist inside list

2009-05-04 Thread MRAB
Matthias Gallé wrote: bearophileh...@lycos.com wrote: John O'Hagan: li=['a', 'c', 'a', 'c', 'c', 'g', 'a', 'c'] for i in range(len(li)): if li[i:i + 2] == ['a', 'c']: li[i:i + 2] = ['6'] Oh well, I have done a mistake, it seems. Another solution then: 'acaccgac'.replace(ac,

Re: find sublist inside list

2009-05-04 Thread Matthias Gallé
bearophileh...@lycos.com wrote: John O'Hagan: li=['a', 'c', 'a', 'c', 'c', 'g', 'a', 'c'] for i in range(len(li)): if li[i:i + 2] == ['a', 'c']: li[i:i + 2] = ['6'] Oh well, I have done a mistake, it seems. Another solution then: 'acaccgac'.replace(ac, chr(6)) '\x06\x06cg\x06'

Re: Code works fine except...

2009-05-04 Thread Ross
On May 4, 7:01 am, Ross ross.j...@gmail.com wrote: On May 3, 10:16 pm, John Yeung gallium.arsen...@gmail.com wrote: On May 3, 11:29 pm, Chris Rebert c...@rebertia.com wrote: Probably not the cause of the problem, but where did the magic numbers 1.072 and 1.08 come from? It is

Re: IDE for python 2.6 (auto complete)

2009-05-04 Thread Mike Driscoll
On May 4, 10:13 am, Soumen banerjee soume...@gmail.com wrote: Hello, I have just installed and run python 2.6.2 from the sources available on the website. I notice that SPE (the editor which i used with python 2.5) is not displaying some of the functions new in 2.6 as autocomplete options. Is

Re: How to walk up parent directories?

2009-05-04 Thread David Smith
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? In other words, I'm looking for something like: for x in walkup('/home/matt/projects'): ... print(x) /home/matt/projects

Re: Default padding for Tkinter grid

2009-05-04 Thread Gabriel Genellina
En Mon, 04 May 2009 10:27:49 -0300, Amr amrbek...@gmail.com escribió: 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

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 zasaconsult...@gmail.com 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,

Re: if statement, with function inside it: if (t = Test()) == True:

2009-05-04 Thread Antoon Pardon
On 2009-04-24, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote: Hello, I'm trying to do a if statement with a function inside it. I want to use that variable inside that if loop , without defining it. def Test():

Re: fcntl and siginfo_t in python

2009-05-04 Thread ma
Ok! So, I decided to write a C-extension instead of using ctypes. So far, I create a module called dnotifier and the handler callback receives two arguments, the signal number and the respective file descriptor that was modified. This works beautifully. Now, I want to release this to the public,

Re: Code works fine except...

2009-05-04 Thread Ross
On May 3, 8:29 pm, John Machin sjmac...@lexicon.net wrote: On May 4, 12:36 pm, Ross ross.j...@gmail.com wrote: For the past couple weeks, I've been working on an algorithm to schedule tennis leagues given court constraints and league considerations (i.e. whether it's a singles or a

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 Matthew Wilson
On Sun 03 May 2009 09:24:59 PM EDT, Ben Finney wrote: Not every simple function belongs in the standard library :-) Thanks for the help with this! Maybe I'm overestimating how often people need this walkup function. Matt -- http://mail.python.org/mailman/listinfo/python-list

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 m...@tplus1.com 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: Your confirmation is required to join the Python-list mailing list

2009-05-04 Thread Allan Yuan
Hi, I just wanna know how to set SYSTEM variables and USER variables of windows, but got no way. Firstly I thought os.environ + os.system may work well, but found no way to let os.environ run to retrive USER variables. Then I tried win32api, finding the GetEnvironmentVariables() mixing SYSTEM

Re: AutoComplete in C++ Editor for Python

2009-05-04 Thread flamz3d
On May 3, 3:14 pm, Dave Angel da...@ieee.org wrote: flam...@gmail.com wrote: Hello, I am embedding python support in my C++ application and was looking at adding Intellisense or AutoComplete support. I found a way to do it using the dir function, but this creates a problem. Here's why.

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

Re: Code works fine except...

2009-05-04 Thread Aahz
In article 8d4ec1df-dddb-469a-99a1-695152db7...@n4g2000vba.googlegroups.com, Ross ross.j...@gmail.com wrote: def test_round_robin(players, rounds, courts, doubles = False): players = range(players) for week in round_robin(players,rounds,courts): if doubles == True:

Re: find sublist inside list

2009-05-04 Thread Aahz
In article gtmlsk$q5...@amma.irisa.fr, =?ISO-8859-1?Q?Matthias_Gall=E9?= mga...@irisa.fr wrote: 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

How is the start of my server monitoring code?

2009-05-04 Thread Echo
I just started a project to monitor servers(load, memory, processes, etc) via ssh(using paramiko). And I was hoping to get some input on the design of my project, how pythonic it is, etc. It is quite basic right now. But it is currently able to get load and memory stats from any number of servers.

Re: [ANN] regobj - Pythonic object-based access to the Windows Registry

2009-05-04 Thread Glenn Linderman
On approximately 5/3/2009 7:35 AM, came the following characters from the keyboard of Ryan Kelly: Hi All, I've just released the results of a nice Sunday's coding, inspired by one too many turns at futzing around with the _winreg module. The regobj module brings a convenient and clean

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

2009-05-04 Thread Aahz
In article 68d22002-fc0a-4590-9395-c78b6ee41...@r34g2000vba.googlegroups.com, Alexzive zasaconsult...@gmail.com wrote: I have this matrix [20*4 - but it could be n*4 , with n~100,000] in file EL_list like this: Take a look at NumPy -- Aahz (a...@pythoncraft.com) *

Re: IDE for python 2.6 (auto complete)

2009-05-04 Thread Detlev Offenbach
Mike Driscoll wrote: On May 4, 10:13 am, Soumen banerjee soume...@gmail.com wrote: Hello, I have just installed and run python 2.6.2 from the sources available on the website. I notice that SPE (the editor which i used with python 2.5) is not displaying some of the functions new in 2.6 as

Re: find sublist inside list

2009-05-04 Thread John O'Hagan
On Mon, 4 May 2009, Francesco Guerrieri wrote: On Mon, May 4, 2009 at 3:01 PM, John O'Hagan m...@johnohagan.com 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

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

2009-05-04 Thread CTO
Which brings us backs to the 20 questions-part of my earlier post. It could be, but it could also be that processing takes seconds. Or it takes so long that even concurrency won't help. Who knows? Probably the OP ;) Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list

Open a dialog from MainWindow - pyQT4 - Beginner :-)

2009-05-04 Thread Florian Wollenschein
Dear folks, I'm just working on a pyQT4 version of my txt to html converter thc (see listick.org for details). I created the MainWindow with QT Designer and then converted it to .py with pyuic4. It works well so far. Then I created a new UI for my abtDialog (about dialog for my

Personal recommendations for Python and Django on-boarding materials

2009-05-04 Thread Grant Rettke
Hi folks, From one developer to another, I am looking for some personal recommendations on what are the best materials for fast tracking an on- boarding to Python and Django. I know how to program, get web apps and OO; this is the audience. I have found some good recommendations and stuff on

Re: find sublist inside list

2009-05-04 Thread mzdude
On May 4, 9:01 am, Matthias Gallé mga...@irisa.fr wrote: bearophileh...@lycos.com wrote: John O'Hagan: li=['a', 'c', 'a', 'c', 'c', 'g', 'a', 'c'] for i  in range(len(li)):     if li[i:i + 2] == ['a', 'c']:         li[i:i + 2] = ['6'] Oh well, I have done a mistake, it seems.

improved search algorithm

2009-05-04 Thread grahamdick77
Hi I have an excel file that is read into python (8000 rows) from csvimport reader, writer incsv = reader(open(MY_FILE), dialect='excel') keys = incsv.next() There are mixed datatypes. the last column contains a cumulative frequency running in order 0. to 1. for the 8000 rows

Re: Self function

2009-05-04 Thread bearophileHUGS
Steve Howell: two methods with almost identical names, where one function is the public interface and then another method that does most of the recursion. Thanks Guido Walter both Python and D support nested functions, so in such situations I put the recursive function inside the public

pychecker vs pychecker2

2009-05-04 Thread qhfgva
For my edification I was looking through the source code of pychecker. I noticed that there was also a pychecker2 directory (ubuntu). The pychecker command line tool points to pychecker (w/out the 2). Does anyone know off the top of their head what this second directory is about? thanks

change some lines from a read file

2009-05-04 Thread utab
Dear all, I have to change some lines from a template file, which is rather long to paste here, but I would like to make some parts of some lines optional with my command line arguments but I could not see this directly, I can count the line numbers and decide on this basis to decide the lines to

Re: improved search algorithm

2009-05-04 Thread MRAB
grahamdic...@gmail.com wrote: Hi I have an excel file that is read into python (8000 rows) from csvimport reader, writer incsv = reader(open(MY_FILE), dialect='excel') keys = incsv.next() There are mixed datatypes. the last column contains a cumulative frequency running in order

Re: Self function

2009-05-04 Thread Arnaud Delobelle
bearophileh...@lycos.com writes: Steve Howell: two methods with almost identical names, where one function is the public interface and then another method that does most of the recursion. Thanks Guido Walter both Python and D support nested functions, so in such situations I put the

Re: change some lines from a read file

2009-05-04 Thread MRAB
utab wrote: Dear all, I have to change some lines from a template file, which is rather long to paste here, but I would like to make some parts of some lines optional with my command line arguments but I could not see this directly, I can count the line numbers and decide on this basis to

Re: Self function

2009-05-04 Thread bearophileHUGS
Arnaud Delobelle: def fac(n):     def rec(n, acc):         if n = 1:             return acc         else:             return rec(n - 1, n*acc)     return rec(n, 1) Right, that's another way to partially solve the problem I was talking about. (Unfortunately the performance in Python is

Re: Self function

2009-05-04 Thread Aahz
In article cee041da-a1e0-4d82-b4ba-5404811d3...@t10g2000vbg.googlegroups.com, bearophileh...@lycos.com wrote: Arnaud Delobelle: Bearophile, there is a thread on python-ideas about tail-call optimization at the moment. Someday I'll have to start following those mailing lists... But I am not

Re: Personal recommendations for Python and Django on-boarding materials

2009-05-04 Thread Arnaud Delobelle
Grant Rettke gret...@gmail.com writes: Hi folks, From one developer to another, I am looking for some personal recommendations on what are the best materials for fast tracking an on- boarding to Python and Django. I know how to program, get web apps and OO; this is the audience. I have

Re: change some lines from a read file

2009-05-04 Thread Anthra Norell
utab wrote: Dear all, I have to change some lines from a template file, which is rather long to paste here, but I would like to make some parts of some lines optional with my command line arguments but I could not see this directly, I can count the line numbers and decide on this basis to

Re: yet another list comprehension question

2009-05-04 Thread namekuseijin
On May 4, 9:15 am, David Robinow drobi...@gmail.com wrote: On Mon, May 4, 2009 at 2:33 AM, namekuseijin namekuseijin.nos...@gmail.com 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.

Re: Self function

2009-05-04 Thread Tim Wintle
On Mon, 2009-05-04 at 19:51 +0100, Arnaud Delobelle wrote: Bearophile, there is a thread on python-ideas about tail-call optimization at the moment. Oooh - haven't noticed that (and don't have time to follow it), but has anyone seen the results I got a week or so ago from briefly playing with

Re: Self function

2009-05-04 Thread bearophileHUGS
Aahz: When have you ever had a binary tree a thousand levels deep? Yesterday. Consider how big 2**1000 is... You are thinking just about complete binary trees. But consider that a topology like a single linked list (every node has 1 child, and they are chained) is a true binary tree still.

Re: Code works fine except...

2009-05-04 Thread Ross
On May 4, 12:15 pm, a...@pythoncraft.com (Aahz) wrote: In article 8d4ec1df-dddb-469a-99a1-695152db7...@n4g2000vba.googlegroups.com, Ross  ross.j...@gmail.com wrote: def test_round_robin(players, rounds, courts, doubles = False):    players = range(players)    for week in

Re: AutoComplete in C++ Editor for Python

2009-05-04 Thread Dave Angel
flam...@gmail.com wrote: On May 3, 3:14 pm, Dave Angel da...@ieee.org wrote: flam...@gmail.com wrote: Hello, I am embedding python support in my C++ application and was looking at adding Intellisense or AutoComplete support. I found a way to do it using the dir function, but

Re: IDE for python 2.6 (auto complete)

2009-05-04 Thread Dave Angel
Soumen banerjee wrote: Hello, I have just installed and run python 2.6.2 from the sources available on the website. I notice that SPE (the editor which i used with python 2.5) is not displaying some of the functions new in 2.6 as autocomplete options. Is there any IDE with support for

Re: How to walk up parent directories?

2009-05-04 Thread Dave Angel
Matthew Wilson wrote: On Sun 03 May 2009 09:24:59 PM EDT, Ben Finney wrote: Not every simple function belongs in the standard library :-) Thanks for the help with this! Maybe I'm overestimating how often people need this walkup function. Matt Look at

Re: Threaded alternatives to smtplib?

2009-05-04 Thread Piet van Oostrum
Alex Jurkiewicz a...@bluebottle.net.au (AJ) wrote: AJ def threadProcessRecipient(): [snip] AJ if __name__ == '__main__': AJTHREADS = [] AJfor i in range(CONCURRENCY): AJTHREADS.append(threading.Thread(target=threadProcessRecipient)) AJfor thread in THREADS: AJ

Re: change some lines from a read file

2009-05-04 Thread norseman
one character at a time, meaning you will have to track EOL's yourself OR import the readline and use it to stand a better chance of getting what you expect from a read file function. Today: 20090504 Logic outline, No particular version HTH -- http://mail.python.org/mailman/listinfo/python

Re: change some lines from a read file

2009-05-04 Thread norseman
one character at a time, meaning you will have to track EOL's yourself OR import the readline and use it to stand a better chance of getting what you expect from a read file function. Today: 20090504 Logic outline, No particular version HTH Steve -- http://mail.python.org/mailman/listinfo

Re: Self function

2009-05-04 Thread Chris Rebert
On Mon, May 4, 2009 at 1:25 PM, bearophileh...@lycos.com wrote: Aahz: When have you ever had a binary tree a thousand levels deep? Yesterday. Consider how big 2**1000 is... You are thinking just about complete binary trees. But consider that a topology like a single linked list (every

Re: Is there is any way to send messages to chunk of emails ID's concurrently using smptlib

2009-05-04 Thread Piet van Oostrum
gganesh ganesh@gmail.com (g) wrote: g Hi friends, g I suppose sendmail() can send mails one by one ,how to send mails g concurrently , g It would be very grateful,if someone could point out a solution. There is a discussion about this in the thread `Threaded alternatives to smtplib?' --

Re: SYSTEM and USER environment (was Your confirmation is required to join the Python-list mailing list)

2009-05-04 Thread Dave Angel
Allan Yuan wrote: Hi, I just wanna know how to set SYSTEM variables and USER variables of windows, but got no way. Firstly I thought os.environ + os.system may work well, but found no way to let os.environ run to retrive USER variables. Then I tried win32api, finding the

Re: Self function

2009-05-04 Thread Arnaud Delobelle
bearophileh...@lycos.com writes: Aahz: When have you ever had a binary tree a thousand levels deep? Yesterday. Consider how big 2**1000 is... You are thinking just about complete binary trees. But consider that a topology like a single linked list (every node has 1 child, and they are

Re: if statement, with function inside it: if (t = Test()) == True:

2009-05-04 Thread Rhodri James
On Mon, 04 May 2009 15:25:44 +0100, Antoon Pardon apar...@forel.vub.ac.be wrote: On 2009-04-24, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote: Hello, I'm trying to do a if statement with a function inside it. I want to

Re: find sublist inside list

2009-05-04 Thread Gabriel Genellina
En Mon, 04 May 2009 15:12:41 -0300, mzdude jsa...@cox.net escribió: substring isn't limited to 0..255 substring = \0x%d\0x%d % (257,257) 'acaccgac'.replace(ac, substring) '\x00x257\x00x257\x00x257\x00x257cg\x00x257\x00x257' This isn't what you think it is. Look carefully: py substring =

Re: Self function

2009-05-04 Thread Terry Reedy
bearophileh...@lycos.com wrote: Another possible syntax: def fact(n): return 1 if n = 1 else n * return(n - 1) But I guess most people don't see this problem as importantcommon enough to justify changing the language. Actually, I would like a way to refer to the current function from

  1   2   3   >