"Shurui Liu (Aaron Liu)" wrote
Sorry, let me specify. I think comptuter will print out those two
sentences like this:
A new critter has been born!
Hi. I'm an instance of class Critter.
A new critter has been born!
Hi. I'm an instance of class Critter.
class Critter(object):
"""A virtual p
Shurui Liu (Aaron Liu) wrote:
I am studying about how to create a constructor in a Python program, I
don't really understand why the program print out "A new critter has
been born!" and "Hi. I'm an instance of class Critter." twice. I
guess is because "crit1 = Critter() crit2 = Critter()"
On 4/4/2010 11:11 AM Shurui Liu (Aaron Liu) said...
Sorry, let me specify. I think comptuter will print out those two
sentences like this:
It's a little more interesting as you move forward from here. This is a
small step...
class Critter(object):
"""A virtual pet"""
def __init__(s
On 04/05/10 04:11, Shurui Liu (Aaron Liu) wrote:
> But the result I got from computer is like this:
> A new critter has been born!
> A new critter has been born!
>
> Hi. I'm an instance of class Critter.
>
> Hi. I'm an instance of class Critter.
Because you tell it to do it in that order:
cr
Sorry, let me specify. I think comptuter will print out those two
sentences like this:
A new critter has been born!
Hi. I'm an instance of class Critter.
A new critter has been born!
Hi. I'm an instance of class Critter.
But the result I got from computer is like this:
A new critter has be
I am studying about how to create a constructor in a Python program, I
don't really understand why the program print out "A new critter has
been born!" and "Hi. I'm an instance of class Critter." twice. I
guess is because "crit1 = Critter() crit2 = Critter()" But I
don't understand how did co