Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-31 Thread Steven D'Aprano
Marc Tompkins wrote: It can be a little hard to wrap your head around how Python handles variables/objects; in other languages you create a variable and assign a value to it, while in Python you create an object and assign a name to it - the name can change while the object remains unchanged. He

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-26 Thread Prasad, Ramit
Tutor] Simple Question On A Method (in subclass) On 10/24/2011 4:40 AM, Alan Gauld wrote: > On 24/10/11 04:08, Chris Kavanagh wrote: > >> Thanks so much for the help Alan. . .I'm not trying to beat this >> question into the ground, LOL, but let me see if I can ask it a better

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-25 Thread Marc Tompkins
On Tue, Oct 25, 2011 at 5:31 AM, Chris Kavanagh wrote: > > > On 10/25/2011 3:50 AM, Dave Angel wrote: > >> On 10/25/2011 12:20 AM, Chris Kavanagh wrote: >> >>> >>> >>> On 10/24/2011 12:06 AM, Marc Tompkins wrote: >>> On Sun, Oct 23, 2011 at 8:08 PM, Chris Kavanagh >>> >>> >>> My proble

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-25 Thread Chris Kavanagh
On 10/25/2011 3:50 AM, Dave Angel wrote: On 10/25/2011 12:20 AM, Chris Kavanagh wrote: On 10/24/2011 12:06 AM, Marc Tompkins wrote: On Sun, Oct 23, 2011 at 8:08 PM, Chris Kavanagh My problem was, I wasn't seeing {member} as referring to the class objects {t} and {s}. Since it was, we now

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-25 Thread Dave Angel
On 10/25/2011 12:20 AM, Chris Kavanagh wrote: On 10/24/2011 12:06 AM, Marc Tompkins wrote: On Sun, Oct 23, 2011 at 8:08 PM, Chris Kavanagh My problem was, I wasn't seeing {member} as referring to the class objects {t} and {s}. Since it was, we now can use member just like any class object

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-24 Thread Marc Tompkins
On Mon, Oct 24, 2011 at 3:44 PM, bob gailer wrote: > On 10/24/2011 7:45 AM, Wayne Werner wrote: > > On Sun, Oct 23, 2011 at 11:06 PM, Marc Tompkins > wrote: > >> Things to remember: >> -you can get a value from a method, but you can't assign to it: >> variable = object.method() >> but NOT

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-24 Thread Marc Tompkins
On Mon, Oct 24, 2011 at 9:20 PM, Chris Kavanagh wrote: > Makes perfect sense now. . .Thanks again Marc (and Alan, Dave) > BTW, do you guys luv Python the way I do!?? I just luv the way everything > works together so explicitly. I LUV learning this stuff!! > Oh yeah, baby. Python makes programmi

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-24 Thread Chris Kavanagh
On 10/24/2011 12:06 AM, Marc Tompkins wrote: On Sun, Oct 23, 2011 at 8:08 PM, Chris Kavanagh mailto:cka...@msn.com>> wrote: So we have {member.tell} as the last line of code. So trying to understand this piece of code, {member} the variable is considered an object? Therefore we can

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-24 Thread bob gailer
On 10/24/2011 7:45 AM, Wayne Werner wrote: On Sun, Oct 23, 2011 at 11:06 PM, Marc Tompkins mailto:marc.tompk...@gmail.com>> wrote: Things to remember: -you can get a value from a method, but you can't assign to it: variable = object.method() but NOT object.method() =

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-24 Thread Alan Gauld
On 24/10/11 11:17, lina wrote: a quick Q: Every time call the method, need go through the __initi__( ) part? No. __init__() is only called when an instance is first created. Here is an example in the IDLE: >>> class C: def __init__(self): print("I'm in init")

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-24 Thread Wayne Werner
On Sun, Oct 23, 2011 at 11:06 PM, Marc Tompkins wrote: > Things to remember: > -you can get a value from a method, but you can't assign to it: > variable = object.method() > but NOT > object.method() = variable > As a slight aside, you _can_ assign to the method name: object.method = var

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-24 Thread Chris Kavanagh
On 10/24/2011 4:40 AM, Alan Gauld wrote: On 24/10/11 04:08, Chris Kavanagh wrote: Thanks so much for the help Alan. . .I'm not trying to beat this question into the ground, LOL, but let me see if I can ask it a better way. Marc has already given a good answer, but I'll try a slightly differ

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-24 Thread lina
a quick Q: Every time call the method, need go through the __initi__( ) part? Thanks, I attached the one I used to practice fast-typing: #!/usr/bin/python3 class SchoolMember: '''Represents any school members.''' def __init__(self,name,age): self.name = name self.age

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-24 Thread Alan Gauld
On 24/10/11 04:08, Chris Kavanagh wrote: Thanks so much for the help Alan. . .I'm not trying to beat this question into the ground, LOL, but let me see if I can ask it a better way. Marc has already given a good answer, but I'll try a slightly different approach to the same thing The diff

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-23 Thread Marc Tompkins
On Sun, Oct 23, 2011 at 8:08 PM, Chris Kavanagh wrote: > So we have {member.tell} as the last line of code. So trying to understand > this piece of code, {member} the variable is considered an object? Therefore > we can combine it with a function {tell()} using dot notation?? Is this > correct???

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-23 Thread Chris Kavanagh
On 10/23/2011 8:28 PM, Alan Gauld wrote: On 24/10/11 00:54, Chris Kavanagh wrote: Speaking of the last line of code, I have a question about that also. The last line should have been (without my error) {member.tell()}. My question is, why couldn't this last line have been {print member}?? I

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-23 Thread Alan Gauld
On 24/10/11 00:54, Chris Kavanagh wrote: Speaking of the last line of code, I have a question about that also. The last line should have been (without my error) {member.tell()}. My question is, why couldn't this last line have been {print member}?? It could have been, but the output would have

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-23 Thread Chris Kavanagh
imple Question On A Method (in subclass) Date: Sun, 23 Oct 2011 16:53:40 -0400 From: Chris Kavanagh Organization: Home Office To: d...@davea.name On 10/22/2011 6:59 PM, Dave Angel wrote: My question is regarding the tell methods in the subclasses,the code {SchoolMember.tell(self)}, in the class Te

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-23 Thread Dave Angel
(please do REPLY-ALL, or at least add the mailing list to the recipient list. Otherwise, only one person will see the message. I'm forwarding it to the group with my comments added.) Original Message Subject: Re: [Tutor] Simple Question On A Method (in subclass) Date

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-22 Thread Alan Gauld
On 22/10/11 23:10, Chris Kavanagh wrote: My question is regarding the tell methods in the subclasses,the code {SchoolMember.tell(self)}, in the class Teacher & Student. I just don't understand what this is doing? Calling the first method {def tell} from the parent class, I assume? Thats right,

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-22 Thread Dave Angel
On 10/22/2011 06:10 PM, Chris Kavanagh wrote: Hello, First, thank you for providing this GREAT service, & THANKS to everyone who contributes. It's greatly appreciated. . .I'm new to Python (2.7, Win XP) & new to programming in general. I have been studying on my own for about a month now. I bel

[Tutor] Simple Question On A Method (in subclass)

2011-10-22 Thread Chris Kavanagh
Hello, First, thank you for providing this GREAT service, & THANKS to everyone who contributes. It's greatly appreciated. . .I'm new to Python (2.7, Win XP) & new to programming in general. I have been studying on my own for about a month now. I believe I have a good grasp of the basics. Secon