Re: [Tutor] cartesian product recursive loop

2006-07-18 Thread Kent Johnson
Gabriel Farrell wrote: >> > Each call to rloop() has its own local variables and its own state. >> > Returning from one call doesn't pop all the way up the stack, it >> > resumes execution at the point of call with the local state restored >> > to what it was before the call. >> > > Okay, this

Re: [Tutor] cartesian product recursive loop

2006-07-18 Thread Gabriel Farrell
On Tue, Jul 18, 2006 at 01:33:27PM -0400, Kent Johnson wrote: > Each call to rloop() has its own local variables and its own state. > Returning from one call doesn't pop all the way up the stack, it > resumes execution at the point of call with the local state restored > to what it was before the c

Re: [Tutor] Comparing times

2006-07-18 Thread John Fouhy
On 18/07/06, Steve Nelson <[EMAIL PROTECTED]> wrote: > What I want to do is establish if the time of the process is *later* > than the system date. For example, we might have a process with a > time of 11:15:00, when the system time is 10:00:00. In practice this > means that the process is from 1

Re: [Tutor] General programming question

2006-07-18 Thread Danny Yoo
> For example, let's say we have a program that deals with drawing shapes > like circles. One way we could imagine doing this is to represent a > circle as an x/y coordinate, a radius, and a color. In this situation, > things that work on circles will take in at least those three arguments:

Re: [Tutor] General programming question

2006-07-18 Thread Danny Yoo
On Tue, 18 Jul 2006, Christopher Arndt wrote: >> I have a general question about programming. My program that I have >> been writing is fully modularized. My question is: Is there a >> programming technique that would alleviate the passing of a huge number >> of variables. One of the things

Re: [Tutor] python file browser with urwid

2006-07-18 Thread Tiago Saboga
Thank you Kent, I've done the modifications you suggested, and the code follows. I splitted the __init__ method in four methods (__init__, header, footer, dir_browser) and took the get_file_names out of pyrun class. Now I have two more general questions, if you don't mind. 1) (first a philosoph

Re: [Tutor] General programming question

2006-07-18 Thread Christopher Arndt
Tino Dai schrieb: > I have a general question about programming. My program that I have > been writing is fully modularized. My question is: Is there a > programming technique that would alleviate the passing of a huge number > of variables. Yes, it's called "object-oriented programming" ;-)

Re: [Tutor] Win32Com.client help

2006-07-18 Thread Bob Gailer
Gardner, Dean wrote: > > Hi > > I have been looking at simple examples of controlling applications > like excel and word using python. All seems well until I read in a > word document with multiple lines. It then seems to pick out seemingly > random sections of the document to display. > > This

Re: [Tutor] python challenge 2

2006-07-18 Thread Bob Gailer
devayani barve wrote: > this is what i did for level 2 of python challenge: Please don't publish challenge solutions. That defeats the purpose of the challenge. That said your program takes a very circuitous route to iterate thru a string. Why not just: dict = ... s = ... for c in s: print

Re: [Tutor] cartesian product recursive loop

2006-07-18 Thread Kent Johnson
Gabriel Farrell wrote: > In trying to combine a set of lists together, I landed upon > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302478 , which > does the job beautifully. The problem is I really want to understand > how it does it, and I can't quite get my brain wrapped around it. >

[Tutor] cartesian product recursive loop

2006-07-18 Thread Gabriel Farrell
In trying to combine a set of lists together, I landed upon http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302478 , which does the job beautifully. The problem is I really want to understand how it does it, and I can't quite get my brain wrapped around it. I'll try to explain, step by ste

Re: [Tutor] about copy.copy

2006-07-18 Thread Danny Yoo
On Tue, 18 Jul 2006, linda.s wrote: > But in the following example, a/b/c change and it looks like there is > no difference. a=[[1,2,3], [4,5,6]] b=a c=copy.copy(a) Hi Linda, I find it easiest to explain this by going to box-and-pointer diagrams. Let me see if this will help y

Re: [Tutor] General programming question

2006-07-18 Thread Kent Johnson
Tino Dai wrote: > On 7/18/06, *Kent Johnson* <[EMAIL PROTECTED] > > wrote: > > Tino Dai wrote: > > Hi Everybody, > > > > I have a general question about programming. My program that I > > have been writing is fully modularized. My question is: Is

Re: [Tutor] General programming question

2006-07-18 Thread Kent Johnson
Tino Dai wrote: > Hi Everybody, > > I have a general question about programming. My program that I > have been writing is fully modularized. My question is: Is there a > programming technique that would alleviate the passing of a huge > number of variables. Let me further elucidate. I could

[Tutor] Win32Com.client help

2006-07-18 Thread Gardner, Dean
Title: Win32Com.client help Hi I have been looking at simple examples of controlling applications like excel and word using python. All seems well until I read in a word document with multiple lines. It then seems to pick out seemingly random sections of the document to display. This is

[Tutor] General programming question

2006-07-18 Thread Tino Dai
Hi Everybody, I have a general question about programming. My program that I have been writing is fully modularized. My question is: Is there a programming technique that would alleviate the passing of a huge number of variables. Let me further elucidate. I could see a day when I would be writi

Re: [Tutor] about copy.copy

2006-07-18 Thread Kent Johnson
Luke Paireepinart wrote: > linda.s wrote: > >> what is the difference between b and c in the following code? >> > #---copyexample.py > import copy > a=[1,4,5] > b=a > c=copy.copy(a) > > del(a[0]) > print a > print b > print c > > #---eof > > output: > [4, 5] > [4, 5] > [1, 4, 5] > > > I.E.

[Tutor] Comparing times

2006-07-18 Thread Steve Nelson
Hello there, I need to be able to compare time on a process tree with system time, and take action accordingly. Here's how I get the time on the process tree: >>> for line in os.popen("ps -ef", "r"): ... if "telnet" in line: ... print line.split()[4] ... 11:00:25 11:01:31 10:01:

Re: [Tutor] about copy.copy

2006-07-18 Thread Wolfram Kraus
On 18.07.2006 09:58, linda.s wrote: > But in the following example, a/b/c change and it looks like there is > no difference. a=[[1,2,3], [4,5,6]] b=a c=copy.copy(a) a[0][0]='a' a > [['a', 2, 3], [4, 5, 6]] b > [['a', 2, 3], [4, 5, 6]] c > [['a', 2, 3], [4, 5, 6]]

Re: [Tutor] about copy.copy

2006-07-18 Thread Kent Johnson
Luke Paireepinart wrote: > linda.s wrote: > >> But in the following example, a/b/c change and it looks like there is >> no difference. >> > I don't know then :) > I'm sure Kent or Alan can give you the lowdown. They're probably > sleepin' right now or something. The python tutors never

Re: [Tutor] python challenge 2

2006-07-18 Thread Kent Johnson
devayani barve wrote: > this is what i did for level 2 of python challenge: Please don't post verbatim solutions to the challenges, let's leave some challenge in it for those who come after. Kent ___ Tutor maillist - Tutor@python.org http://mail.pyth

Re: [Tutor] about copy.copy

2006-07-18 Thread Luke Paireepinart
linda.s wrote: > But in the following example, a/b/c change and it looks like there is > no difference. I don't know then :) I'm sure Kent or Alan can give you the lowdown. They're probably sleepin' right now or something. I'd say try googling 'copy.copy documentation', see what you get. ___

Re: [Tutor] about copy.copy

2006-07-18 Thread linda.s
But in the following example, a/b/c change and it looks like there is no difference. >>> a=[[1,2,3], [4,5,6]] >>> b=a >>> c=copy.copy(a) >>> a[0][0]='a' >>> a [['a', 2, 3], [4, 5, 6]] >>> b [['a', 2, 3], [4, 5, 6]] >>> c [['a', 2, 3], [4, 5, 6]] On 7/18/06, Luke Paireepinart <[EMAIL PROTECTED]> wr

Re: [Tutor] about copy.copy

2006-07-18 Thread Luke Paireepinart
linda.s wrote: > what is the difference between b and c in the following code? #---copyexample.py import copy a=[1,4,5] b=a c=copy.copy(a) del(a[0]) print a print b print c #---eof output: [4, 5] [4, 5] [1, 4, 5] I.E. 'b' is just a reference to 'a', so modifying 'a' by deleting an element cha

[Tutor] about copy.copy

2006-07-18 Thread linda.s
what is the difference between b and c in the following code? import copy a=[1,4,5] b=a c=copy.copy(a) Linda ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor