Re: [Tutor] read from standard input

2008-02-13 Thread John Fouhy
On 14/02/2008, Andrei Petre <[EMAIL PROTECTED]> wrote: > Hello, > > I want to read from the standard input numbers until i reach a certain value > or to the end of the "file". > What is the simplest, straightforward, pythonic way to do it? > > a sketch of how i tried to do it: > [code] > while 1 <

[Tutor] read from standard input

2008-02-13 Thread Andrei Petre
Hello, I want to read from the standard input numbers until i reach a certain value or to the end of the "file". What is the simplest, straightforward, pythonic way to do it? a sketch of how i tried to do it: [code] while 1 < 2: x = raw_input() if type(x) != int or x == 11: break

Re: [Tutor] Binary chop function - this works, but I'm not sure why

2008-02-13 Thread Chris Fuller
On Wednesday 13 February 2008 18:49, Arun Srinivasan wrote: > I'm trying to learn Python, and I decided to try kata 2 from the > CodeKate website. It's basically just a challenge to implement a binary > search in different ways. > > I wrote an implementation that works, but I'm confused as to why.

[Tutor] Binary chop function - this works, but I'm not sure why

2008-02-13 Thread Arun Srinivasan
I'm trying to learn Python, and I decided to try kata 2 from the CodeKate website. It's basically just a challenge to implement a binary search in different ways. I wrote an implementation that works, but I'm confused as to why. def chop(search_int, sorted_list): if len(sorted_list) == 1 or

Re: [Tutor] Change dictionary value depending on a conditional statement.

2008-02-13 Thread Terry Carroll
I don't think I saw anyone point this out yet, but, using "list" as a variable name is a bad idea, because it hides the list method. >>> x = list("abcdefg") >>> x ['a', 'b', 'c', 'd', 'e', 'f', 'g'] This works. You now have a variable named "x" that is a list. >>> list = list("hijklmnop") >>> l

Re: [Tutor] Understanding the ImageDraw Options

2008-02-13 Thread Alan Gauld
"Wayne Watson" <[EMAIL PROTECTED]> wrote Caveat, I've never used ImageDraw >I started getting acquainted with the ImageDraw class (Object). > My question > here is are there more detailed explanations somewhere > for the options? There is an Op

Re: [Tutor] Understanding the ImageDraw Options

2008-02-13 Thread Kent Johnson
Wayne Watson wrote: > I started getting acquainted with the ImageDraw class (Object). > My question here is are > there more detailed explanations somewhere for the options? > > It gives no idea what the choices are for options in the argument list

Re: [Tutor] beginner pexpect question

2008-02-13 Thread Nathan McBride
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Anyone have any recomendations? Seems like it is giving it the passwords since it finishes cleanly, but maybe not like I think? Nate Nathan McBride wrote: > Hey guys, > > I'm practically still a beginner with python. I am working on a program > tha

[Tutor] Understanding the ImageDraw Options

2008-02-13 Thread Wayne Watson
I started getting acquainted with the ImageDraw class (Object).   My question here is are there more detailed explanations somewhere for the options? Here's a description for line from that source: === line draw.line(xy, options)  <= OPTIONS Draws a line between the coo

Re: [Tutor] Various Topics from IDLE to ImageDraw Options

2008-02-13 Thread Alan Gauld
"Wayne Watson" <[EMAIL PROTECTED]> wrote Hi Wayne, welcome to the tutor list. One wee point, dont reply to existing messages with a new subject. Those of us using threaded readers are likely to miss it unless we are folowing the thread. tHis one popped up halfway through the long thread on POOP!

[Tutor] beginner pexpect question

2008-02-13 Thread Nathan McBride
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey guys, I'm practically still a beginner with python. I am working on a program that originally I used popen for but then switched to pexpect because it was easier for me to understand. I was hoping someone could help me get this working: I do a:

[Tutor] Various Topics from IDLE to ImageDraw Options

2008-02-13 Thread Wayne Watson
I'm just getting started in Python but have begun with a challenging project. It's a 2000+ line program that provides works with a GUI for essentially a video device. As such, it displays dialogs, still images, push buttons, menus, and the like. It uses OOP. Ten years ago I was into OOP with C+

Re: [Tutor] designing POOP

2008-02-13 Thread Kent Johnson
Tiger12506 wrote: > vg = VideoGame() > howmany = rand.randint(0,100) > for i in range(howmany): > vg.buttonpush() > print vg.score#Tear open the case (hope you have a screwdriver) > > OR > > class VideoGame(): > def __init__(self): > self.score = 0 > def updatedisp(): > pr

Re: [Tutor] designing POOP

2008-02-13 Thread Kent Johnson
Alan Gauld wrote: > This is fine and dandy but what if we want to find out the > current value of a.value without calling inc? > Thats where hetter/setter/direct access comes into the > picture. > In Java and some other languages the idiomatic thing > to do is provide methods prefixed with get/s