Re: [Tutor] Why doesn't it choose a new number each time?

2007-02-13 Thread Rikard Bosnjakovic
On 2/14/07, Nathan Pinno <[EMAIL PROTECTED]> wrote: > I wrote a rock, paper, scissors game and every time you play without > exiting, it chooses the same number. How can I fix this problem? The > relative code is below: [...] > compchoice = choice(range(3)) [...] >>> range(3) [0, 1, 2]

[Tutor] critique my script: add columns in a file

2007-02-13 Thread Christopher Spears
I created a file called table.txt. Here is the file's contents: 1 5 10 2 1.0 2 10 20 4 2.0 3 3 15 30 8 3 2 1 4 20 40 16 4.0 I modified a script I found in "Programming Python" and created scri

Re: [Tutor] Accessing class attributes: use methods only?

2007-02-13 Thread Kent Johnson
Bob Gailer wrote: > I really like the simplicity of a.b = 3. I groan when put in other > environments where a method call is required. > > And Python has the magic method __setattr__ to intercept attribute > assignment for the times where some inspection / protection / > side-effect action is d

Re: [Tutor] Why doesn't it choose a new number each time?

2007-02-13 Thread wesley chun
> I wrote a rock, paper, scissors game and every time you play without > exiting, it chooses the same number. How can I fix this problem? The > relative code is below: >: > compchoice = choice(range(3)) hey nathan, neat program... that's one of the homework assignments in my boo

Re: [Tutor] Why doesn't it choose a new number each time?

2007-02-13 Thread Alan Gauld
"Nathan Pinno" <[EMAIL PROTECTED]> wrote > I wrote a rock, paper, scissors game and every time you play > without exiting, it chooses the same number. How can I fix this > problem? The relative code is below: I can't see anything obvious, can you be more specific. Which number does it always cho

[Tutor] Why doesn't it choose a new number each time?

2007-02-13 Thread Nathan Pinno
Hey all, I wrote a rock, paper, scissors game and every time you play without exiting, it chooses the same number. How can I fix this problem? The relative code is below: [code] # -*- coding: cp1252 -*-from random import * print "Welcome to Rock, Paper, or Scissors!"print "by Nathan Pinno"pr

Re: [Tutor] Multiple Tk frames

2007-02-13 Thread Alan Gauld
"Hazlett, Les" <[EMAIL PROTECTED]> wrote > I have found many simple examples of using Tk with one frame. > I found self.quit to close the open frame object. > I see that control goes to the end of main, but I don't know > how to then create and use another frame. You first need to get your termin

Re: [Tutor] Accessing class attributes: use methods only?

2007-02-13 Thread Alan Gauld
"Chris Lasher" <[EMAIL PROTECTED]> wrote > Is it general good practice to access and set class attributes via > methods only, or is it okay practice to directly interact with class > attributes? Its generally good OOP practice to interact with object via messages. Its also good practice NOT to ac

[Tutor] New Tutor topic(almost)

2007-02-13 Thread Alan Gauld
Hi gang, After a very long delay I finally got some work done on my networking with sockets topic in my tutorial. There is still a section to complete but the introductory explanations and examples are now on the site. http://www.freenetpages.co.uk/hp/alan.gauld/tutsocket.htm If anyone has an

Re: [Tutor] Multiple Tk frames

2007-02-13 Thread John Fouhy
On 14/02/07, Hazlett, Les <[EMAIL PROTECTED]> wrote: > I have found many simple examples of using Tk with one frame. I found > self.quit to close the open frame object. I see that control goes to the > end of main, but I don't know how to then create and use another frame. Hi Les, In Tkinter pa

Re: [Tutor] Accessing class attributes: use methods only?

2007-02-13 Thread Bob Gailer
Chris Lasher wrote: > Is it general good practice to access and set class attributes via > methods only, or is it okay practice to directly interact with class > attributes? The professor in a class on Perl that I'm taking suggested > that directly accessing and setting class attributes was a bad i

Re: [Tutor] Accessing class attributes: use methods only?

2007-02-13 Thread Kent Johnson
Chris Lasher wrote: > Is it general good practice to access and set class attributes via > methods only, or is it okay practice to directly interact with class > attributes? The professor in a class on Perl that I'm taking suggested > that directly accessing and setting class attributes was a bad i

[Tutor] Multiple Tk frames

2007-02-13 Thread Hazlett, Les
Hi, I have found many simple examples of using Tk with one frame. I found self.quit to close the open frame object. I see that control goes to the end of main, but I don't know how to then create and use another frame. Below is a "cut-down" version of what I have tried. Thanks for any help,

Re: [Tutor] Accessing class attributes: use methods only?

2007-02-13 Thread Luke Paireepinart
Chris Lasher wrote: > Is it general good practice to access and set class attributes via > methods only, or is it okay practice to directly interact with class > attributes? The professor in a class on Perl that I'm taking suggested > that directly accessing and setting class attributes was a bad i

[Tutor] Accessing class attributes: use methods only?

2007-02-13 Thread Chris Lasher
Is it general good practice to access and set class attributes via methods only, or is it okay practice to directly interact with class attributes? The professor in a class on Perl that I'm taking suggested that directly accessing and setting class attributes was a bad idea. Just wondering what the

Re: [Tutor] Python for Sysadmins

2007-02-13 Thread Kent Johnson
Christopher Arndt wrote: > Steve Nelson schrieb: >> I'd like some suggestions for a course outline - bear in mind I'll >> only have a day for the course. The attendees are all sysadmins with >> a UNIX background, and are reasonably comfortable with shell, but >> nothing else. You might get some i

Re: [Tutor] Python for Sysadmins

2007-02-13 Thread Dave Kuhlman
On Tue, Feb 13, 2007 at 03:15:54PM +, Steve Nelson wrote: > I'd like some suggestions for a course outline - bear in mind I'll > only have a day for the course. The attendees are all sysadmins with > a UNIX background, and are reasonably comfortable with shell, but > nothing else. You might

Re: [Tutor] Python for Sysadmins

2007-02-13 Thread William O'Higgins Witteman
On Tue, Feb 13, 2007 at 04:38:47PM +0100, Christopher Arndt wrote: >Steve Nelson schrieb: >> I'd like some suggestions for a course outline - bear in mind I'll >> only have a day for the course. The attendees are all sysadmins with >> a UNIX background, and are reasonably comfortable with shell, b

Re: [Tutor] Recursion limit

2007-02-13 Thread Eike Welk
Thank you! I have a program myself that does a lot of recursion. Regards, Eike. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python for Sysadmins

2007-02-13 Thread Christopher Arndt
Steve Nelson schrieb: > I'd like some suggestions for a course outline - bear in mind I'll > only have a day for the course. The attendees are all sysadmins with > a UNIX background, and are reasonably comfortable with shell, but > nothing else. Must topics (apart from the basic Python stuff): -

[Tutor] Python for Sysadmins

2007-02-13 Thread Steve Nelson
Hello chaps, So further to the MapReduce question, it helped greatly, and I got the job, so I'll now be programming Ruby for a living... Before I leave my present job, I've been asked to put together a day's course on Python for Sysadmins. This is mainly to enable them to maintain my code, and g

Re: [Tutor] Recursion limit

2007-02-13 Thread Kent Johnson
Eike Welk wrote: > Hello Allan! > > On Monday 12 February 2007 22:17, Alan Gauld wrote: >> The figure 999 is interesting. Python has a recursion limit of 1000 >> levels. Do you by any chance use recursion to call your function? > > Is the recursion limit hard coded, or can it be changed? It is s

Re: [Tutor] telnet read_until problems

2007-02-13 Thread Eike Welk
Hello Allan! On Monday 12 February 2007 22:17, Alan Gauld wrote: > The figure 999 is interesting. Python has a recursion limit of 1000 > levels. Do you by any chance use recursion to call your function? Is the recursion limit hard coded, or can it be changed? Regards, Eike.

Re: [Tutor] Compiling a program ::Embedding Python in C

2007-02-13 Thread Alan Gauld
"Shadab Sayani" <[EMAIL PROTECTED]> wrote I can't help with the compile issues but a couple of quick points... > I have a C program mm.c calling python function as > follows:: > #include "Python.h" > #include > > int main(int argc, char* argv[]) > { >double answer = 0; >PyObjec

Re: [Tutor] Accessing installed windows software from python

2007-02-13 Thread Alan Gauld
"Jalil" <[EMAIL PROTECTED]> wrote >I was wondering if its possible to go about writing a code to find >out all > the installed program on a windows machines. Basically everything > under Add > Remove Programs in the control panel. I believe thats done by searching the Windows registry. You c

Re: [Tutor] Compiling a program ::Embedding Python in C

2007-02-13 Thread Shadab Sayani
Hi, I am using FC3. On issuing the command given by you I got the same response.So how can I fix it? My main line of execution is C.My intention is to use python in C to do some operations.I have a main function in C code.I want to compile it get its executable and execute it to get the output whic

Re: [Tutor] Compiling a program ::Embedding Python in C

2007-02-13 Thread Rikard Bosnjakovic
On 2/13/07, Shadab Sayani <[EMAIL PROTECTED]> wrote: [...] > /usr/local/lib/python2.4/config/libpython2.4.a(dynload_shlib.o)(.text+0x1f6):Python/dynload_shlib.c:133: > undefined reference to `dlerror' [...] You have not provided enough information for us to help you. What system do you use? It l

Re: [Tutor] Accessing installed windows software from python

2007-02-13 Thread Rikard Bosnjakovic
On 2/13/07, Jalil <[EMAIL PROTECTED]> wrote: > I was wondering if its possible to go about writing a code to find out all > the installed program on a windows machines. Basically everything under Add > Remove Programs in the control panel. There is no support for this in the standard Python-dis