Maarten van Veen wrote:
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()
>
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.
>
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 Stud
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
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 = id
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)
>
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():
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)
>
> 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 i
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 setId(
10 matches
Mail list logo