Re: [Tutor] a logic problem in an if statement

2010-09-26 Thread Bill Allen
On Sun, Sep 26, 2010 at 5:12 PM, Steven D'Aprano wrote: > On Mon, 27 Sep 2010 06:01:35 am Bill Allen wrote: > > Now your decision logic becomes simple, and obvious. It documents > itself: > > if click_in_bottom_half1 and click_in_bottom_half2: >print "Both clicks in bottom half of screen" > el

Re: [Tutor] super.__init__() arguments

2010-09-26 Thread Hugo Arts
On Mon, Sep 27, 2010 at 1:45 AM, Jojo Mwebaze wrote: > Hey Tutor, > Seems a small issue but this has been playing for a while now, what am i > doing wrong here? > Take an Example > Class Point: >    def __init__(self, x=0, y=0): >      self.x = x >      self.y = y > Class Circle(Point): >     def

[Tutor] super.__init__() arguments

2010-09-26 Thread Jojo Mwebaze
Hey Tutor, Seems a small issue but this has been playing for a while now, what am i doing wrong here? Take an Example Class Point: def __init__(self, x=0, y=0): self.x = x self.y = y Class Circle(Point): def __init__(self, radius=0, x=0, y=0): super().__init__(x, y)

Re: [Tutor] Issues In Terminal

2010-09-26 Thread Dave Angel
On 2:59 PM, Bill DeBroglie wrote: No, I meant that you should edit your .py file and add #!/usr/bin/env python as the first line, THEN try to run it. BINGO! Right now what's happening is that you're handing a line of Python script to the shell and asking it to run it; the shell is tellin

Re: [Tutor] Issues In Terminal

2010-09-26 Thread Steven D'Aprano
On Mon, 27 Sep 2010 08:37:08 am Bill DeBroglie wrote: > > No, I meant that you should edit your .py file and add > > #!/usr/bin/env python > > as the first line, THEN try to run it. > > BINGO! > > > Right now what's happening is that you're handing a line of Python > >   script to the shell and ask

Re: [Tutor] Issues In Terminal

2010-09-26 Thread Bill DeBroglie
On Sep 26, 2010, at 6:29 PM, Marc Tompkins wrote: On Sun, Sep 26, 2010 at 3:24 PM, Bill DeBroglie > wrote: Is this what you mean? matthew-parrillas-macbook:Dawson_Book matthewparrilla$ #!/usr/bin/ env python matthew-parrillas-macbook:Dawson_Book matthewparrilla$ ./chapter_2.py ./c

Re: [Tutor] generating formatted output

2010-09-26 Thread Bill Allen
On Sun, Sep 26, 2010 at 4:21 PM, Hugo Arts wrote: > On Sun, Sep 26, 2010 at 10:16 PM, Rance Hall wrote: > > My app will be printing a series of documents that are the same each > > time the doc is printed with the exception of the variables. Sort of > > a MailMerge if you will. > > > > > > I wo

Re: [Tutor] Issues In Terminal

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 3:24 PM, Bill DeBroglie wrote: > > Is this what you mean? > > matthew-parrillas-macbook:Dawson_Book matthewparrilla$ #!/usr/bin/env > python > matthew-parrillas-macbook:Dawson_Book matthewparrilla$ ./chapter_2.py > ./chapter_2.py: line 1: syntax error near unexpected token

Re: [Tutor] Issues In Terminal

2010-09-26 Thread Bill DeBroglie
On Sep 26, 2010, at 6:18 PM, Marc Tompkins wrote: On Sun, Sep 26, 2010 at 3:04 PM, David Hutto wrote: > Pretty sure it's the parentheses, but I'm not an expert. In python 3 you use > print(), in 2.6 you either use import from __futur__ or print "string here". I mean __future__ . The pa

Re: [Tutor] Issues In Terminal

2010-09-26 Thread Bill DeBroglie
On Sep 26, 2010, at 6:06 PM, Marc Tompkins wrote: On Sun, Sep 26, 2010 at 2:55 PM, Bill DeBroglie > wrote: Which is great, but when I try and run the same code in the Terminal by calling a program I've written (print("hello world") again) I get the following: matthews-macbook:Dawson

Re: [Tutor] Issues In Terminal

2010-09-26 Thread Steven D'Aprano
On Mon, 27 Sep 2010 07:55:40 am Bill DeBroglie wrote: [...] > Which is great, but when I try and run the same code in the Terminal > by calling a program I've written (print("hello world") again) I get > the following: How do you call the program? At the shell prompt, if you call: python name_of

Re: [Tutor] Issues In Terminal

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 3:04 PM, David Hutto wrote: > > Pretty sure it's the parentheses, but I'm not an expert. In python 3 you > use > > print(), in 2.6 you either use import from __futur__ or print "string > here". > > I mean __future__ . > The parentheses are optional in 2.6, mandatory in 3.

Re: [Tutor] a logic problem in an if statement

2010-09-26 Thread Steven D'Aprano
On Mon, 27 Sep 2010 06:01:35 am Bill Allen wrote: > #This captures the coordinates the two mouse clicks, successfully. > mouse_pos is in the form (x,y), such as (204,102). > if mouse_pressed == (1,0,0) and first_click == False: > first_click = True > mouse_pos1 = mouse_pos > elif m

Re: [Tutor] Issues In Terminal

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 2:55 PM, Bill DeBroglie wrote: > Which is great, but when I try and run the same code in the Terminal by > calling a program I've written (print("hello world") again) I get the > following: > >matthews-macbook:Dawson_Book matthewparrilla$ ./chapter_2.py >./c

Re: [Tutor] Issues In Terminal

2010-09-26 Thread David Hutto
On Sun, Sep 26, 2010 at 6:03 PM, David Hutto wrote: > On Sun, Sep 26, 2010 at 5:55 PM, Bill DeBroglie > wrote: >> Hello all, >> >> Totally new to this stuff and community so I very much appreciate the help >> and apologize in advance for asking what might be a stupid question... Oh, >> and I'm ne

Re: [Tutor] Issues In Terminal

2010-09-26 Thread David Hutto
On Sun, Sep 26, 2010 at 5:55 PM, Bill DeBroglie wrote: > Hello all, > > Totally new to this stuff and community so I very much appreciate the help > and apologize in advance for asking what might be a stupid question... Oh, > and I'm new to the lingo too!! > > I'm having issues running Python in T

[Tutor] Issues In Terminal

2010-09-26 Thread Bill DeBroglie
Hello all, Totally new to this stuff and community so I very much appreciate the help and apologize in advance for asking what might be a stupid question... Oh, and I'm new to the lingo too!! I'm having issues running Python in Terminal. When I run code through the interpreter I get:

Re: [Tutor] generating formatted output

2010-09-26 Thread Hugo Arts
On Sun, Sep 26, 2010 at 10:16 PM, Rance Hall wrote: > My app will be printing a series of documents that are the same each > time the doc is printed with the exception of the variables.  Sort of > a MailMerge if you will. > > It seems to me that the easiest approach is to create a series of text >

Re: [Tutor] Python And reading the Web - Javascript

2010-09-26 Thread Bill Allen
On Sat, Sep 25, 2010 at 4:29 AM, Sayth Renshaw wrote: > I want to read some data from the web it will be text and numeric i > was planning to export it to a database. I was thinking while I am > learning maybe something simple like Sqlite or MySQL. > > I then want to read back data to perform sort

Re: [Tutor] a logic problem in an if statement

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 1:36 PM, Bill Allen wrote: > I hate it when I do something like that!A combination of poor choice of > names for the variables and programming tunnel vision > Been there, done that! -- www.fsrtechnologies.com ___ Tutor

Re: [Tutor] a logic problem in an if statement

2010-09-26 Thread Bill Allen
On Sun, Sep 26, 2010 at 3:12 PM, Marc Tompkins wrote: > On Sun, Sep 26, 2010 at 1:01 PM, Bill Allen wrote: > >> >> Any thoughts how I am going wrong here? >> >> Looks like you've got two different names for the first mouse click... > > mouse_pos1 = mouse_pos >> > > but > > if mouse_pos[1]

[Tutor] generating formatted output

2010-09-26 Thread Rance Hall
My app will be printing a series of documents that are the same each time the doc is printed with the exception of the variables. Sort of a MailMerge if you will. It seems to me that the easiest approach is to create a series of text files with the layout and placeholders I need (again much like

Re: [Tutor] a logic problem in an if statement

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 1:01 PM, Bill Allen wrote: > > Any thoughts how I am going wrong here? > > Looks like you've got two different names for the first mouse click... mouse_pos1 = mouse_pos > but > if mouse_pos[1] < height/2 and mouse_pos2[1] > height/2: > -- www.fsrtechnologies.

[Tutor] a logic problem in an if statement

2010-09-26 Thread Bill Allen
Ok, I am have a problem with some logic in a piece of code I am working on. I have tinkered with it for hours and am stumped. Pretty sure I have lost sight of the forest for the trees... The purpose of this code is to take the coordinates on screen of the mouse at the time of two mouse clicks,

Re: [Tutor] class method problem

2010-09-26 Thread David Hutto
On Sun, Sep 26, 2010 at 3:14 AM, Steven D'Aprano wrote: > On Sun, 26 Sep 2010 02:26:25 pm David Hutto wrote: >> On Sat, Sep 25, 2010 at 9:16 PM, Steven D'Aprano > wrote: >> > On Sun, 26 Sep 2010 08:13:23 am David Hutto wrote: >> >> Since I had nothing else to do, but practice, this looks much >>

Re: [Tutor] class method problem

2010-09-26 Thread Steven D'Aprano
On Sun, 26 Sep 2010 02:26:25 pm David Hutto wrote: > On Sat, Sep 25, 2010 at 9:16 PM, Steven D'Aprano wrote: > > On Sun, 26 Sep 2010 08:13:23 am David Hutto wrote: > >> Since I had nothing else to do, but practice, this looks much > >> better: > >> > >> def find(word, search): > >>       if searc