[Tutor] any cons to using a module of functions?

2012-02-02 Thread Che M
I have a bunch of functions that do various utility-type tasks in an application (such as prettifying date strings, etc.), and they are used in many modules. Much of the time, I have just been lazily copying and pasting the functions into whichever modules need them. I realize that is very ba

Re: [Tutor] better looping construct for replacing elements in file?

2012-02-02 Thread Alan Gauld
On 02/02/12 21:44, Joel Goldstick wrote: On Thu, Feb 2, 2012 at 4:29 PM, Brett Longworth wrote: Hi Joel, Thanks for the reply. The little voice in my head was yelling, "Easier with SQL!" the entire time, but I'm trying to learn Python. Even so, you would be learning how to do some simple sql

Re: [Tutor] exercise with classes

2012-02-02 Thread Alan Gauld
On 02/02/12 17:36, Tonu Mikk wrote: So far I have searched for info on how to pass variables from one class to another and have been able to create a small two class program (attached). But I seem unable to generalize from here and apply this to the game exercise. What would you suggest for m

Re: [Tutor] exercise with classes

2012-02-02 Thread Alexander Etter
On Feb 2, 2012, at 12:36, Tonu Mikk wrote: > I feel stumped and don't know how to go about creating this game with two > classes. > > So far I have searched for info on how to pass variables from one class to > another and have been able to create a small two class program (attached). > Tha

Re: [Tutor] better looping construct for replacing elements in file?

2012-02-02 Thread Peter Otten
Brett Longworth wrote: > Hello, > > Today I wrote a quick script to replace elements in multiple lines of a > file with corresponding elements from a single line in another file, > linking the two via an index element. The code iterates through the > entire source file to find the matching index

Re: [Tutor] better looping construct for replacing elements in file?

2012-02-02 Thread Joel Goldstick
On Thu, Feb 2, 2012 at 4:29 PM, Brett Longworth wrote: > Hi Joel, > > Thanks for the reply. The little voice in my head was yelling, "Easier with > SQL!" the entire time, but I'm trying to learn Python. > > -Brett > > > On 2/2/2012 4:16 PM, Joel Goldstick wrote: >> >> On Thu, Feb 2, 2012 at 3:50 P

Re: [Tutor] better looping construct for replacing elements in file?

2012-02-02 Thread Brett Longworth
Hi Joel, Thanks for the reply. The little voice in my head was yelling, "Easier with SQL!" the entire time, but I'm trying to learn Python. -Brett On 2/2/2012 4:16 PM, Joel Goldstick wrote: On Thu, Feb 2, 2012 at 3:50 PM, Brett Longworth wrote: Hello, Today I wrote a quick script to repla

Re: [Tutor] better looping construct for replacing elements in file?

2012-02-02 Thread Joel Goldstick
On Thu, Feb 2, 2012 at 3:50 PM, Brett Longworth wrote: > Hello, > > Today I wrote a quick script to replace elements in multiple lines of a file > with corresponding elements from a single line in another file, linking the > two via an index element. The code iterates through the entire source fil

[Tutor] better looping construct for replacing elements in file?

2012-02-02 Thread Brett Longworth
Hello, Today I wrote a quick script to replace elements in multiple lines of a file with corresponding elements from a single line in another file, linking the two via an index element. The code iterates through the entire source file to find the matching index for each line of the destinatio

Re: [Tutor] exercise with classes

2012-02-02 Thread Prasad, Ramit
>I am learning Python using the "Learn Python the Hard Way" book by Zed Shaw. >I reached exercise 42 where we learn about Python classes. The exercise shows >a game with one class that includes all the definitions for playing the game. >For extra credit we are asked to create another version

[Tutor] exercise with classes

2012-02-02 Thread Tonu Mikk
I am learning Python using the "Learn Python the Hard Way" book by Zed Shaw. I reached exercise 42 where we learn about Python classes. The exercise shows a game with one class that includes all the definitions fo

Re: [Tutor] Fwd: Re: trouble placing code into wxpython

2012-02-02 Thread Steven D'Aprano
shane wrote: i was trying to put the math.py into a frame Ive watched many tutorials. But cant seem to find out how to or where to place the code the files I want combined are attached. Do you mean you want to show the code in the GUI? You need to know the location of the file, then read the

Re: [Tutor] Fwd: Re: trouble placing code into wxpython

2012-02-02 Thread Alan Gauld
On 02/02/12 06:56, shane wrote: i was trying to put the math.py into a frame Ive watched many tutorials. That sounds like you've been using video tutorials? Those are a good start but you are probably better using a written one and working through them doing the examples. You can try my GUI