creating and naming objects

2006-06-07 Thread Brian
I have a question that some may consider silly, but it has me a bit stuck and I would appreciate some help in understanding what is going on. For example, lets say that I have a class that creates a student object. Class Student: def setName(self, name) self.name = name def

Re: creating and naming objects

2006-06-07 Thread Tim Chase
def createStudent(): foo = Student() /add stuff Now, suppose that I want to create another Student. Do I need to name that Student something other than foo? What happens to the original object? If you want to keep the old student around, you have to keep a reference to it

Re: creating and naming objects

2006-06-07 Thread Diez B. Roggisch
Brian wrote: I have a question that some may consider silly, but it has me a bit stuck and I would appreciate some help in understanding what is going on. For example, lets say that I have a class that creates a student object. Class Student: def setName(self, name)

Re: creating and naming objects

2006-06-07 Thread Dennis Benzinger
Brian wrote: [...] For example, lets say that I have a class that creates a student object. Class Student: def setName(self, name) self.name = name def setId(self, id) self.id = id Then I instantiate that object in a method: def createStudent(): foo =

Re: creating and naming objects

2006-06-07 Thread Steve Holden
Brian wrote: I have a question that some may consider silly, but it has me a bit stuck and I would appreciate some help in understanding what is going on. For example, lets say that I have a class that creates a student object. Class Student: def setName(self, name)

Re: creating and naming objects

2006-06-07 Thread Brian
Thank you all for your response. I think that I am getting it. Based on those responses, would I be correct in thinking that this would be the way to initialize my Student object and return the values? class Student: def __init__(self, name, id): self.name = name self.id =

Re: creating and naming objects

2006-06-07 Thread Gerard Flanagan
Brian wrote: Thank you all for your response. I think that I am getting it. Based on those responses, would I be correct in thinking that this would be the way to initialize my Student object and return the values? class Student: def __init__(self, name, id): self.name = name

Re: creating and naming objects

2006-06-07 Thread bruno at modulix
Brian wrote: Thank you all for your response. I think that I am getting it. Based on those responses, would I be correct in thinking that this would be the way to initialize my Student object and return the values? class Student: Do yourself a favour: use new-style classes class

Re: creating and naming objects

2006-06-07 Thread Maarten van Veen
In article [EMAIL PROTECTED], Brian [EMAIL PROTECTED] wrote: I have a question that some may consider silly, but it has me a bit stuck and I would appreciate some help in understanding what is going on. For example, lets say that I have a class that creates a student object. Class

Re: creating and naming objects

2006-06-07 Thread Brian
Maarten van Veen wrote: snip Hi Brian, If you would do it like this: Class Student: def setName(self, name) self.name = name def setId(self, id) self.id = id def createStudent(): foo = Student() foo.setName(Brian) foo = Student() print