Thanks everyone for helping me out and tolerating the noob question =D The
last part was confusing to me and thanks for explaining it so I get it!
-Ivan
_
Express yourself instantly with MSN Messenger! Download today - it's FREE!
Ivan Shevanski wrote:
> To continue with my previous problems, now I'm trying out classes. But I
> have a problem (which I bet is easily solveable) that I really don't get.
> The numerous tutorials I've looked at just confsed me.For intance:
>
> >>>class Xyz:
> ... def y(self):
> ...
Ivan Shevanski wrote:
>To continue with my previous problems, now I'm trying out classes. But I
>have a problem (which I bet is easily solveable) that I really don't get.
>The numerous tutorials I've looked at just confsed me.For intance:
>
>
>
class Xyz:
>... def y
On Sat, 01 Oct 2005 18:58:45 -0400, Ivan Shevanski wrote:
> To continue with my previous problems, now I'm trying out classes. But I
> have a problem (which I bet is easily solveable) that I really don't get.
> The numerous tutorials I've looked at just confsed me.For intance:
[code snipped]
Ron Adam wrote:
> Also,
>
> In your example 'q' is assigned the value 2, but as soon as the method
> 'y' exits, it is lost. To keep it around you want to assign it to self.y.
Ooops, That should say ...
"To keep it around you want to assign it to self.q." <---self.q
Cheers,
Ron
--
http
You have to crate an instanciation of the class before you can use one.
So you want to do:
instance = Xyz()
instance.y()
You won't get any output though, might want to do:
class Xyz:
def y(self):
print 'y worked!'
it's more satisfying :)
Basically, look into the difference betwe
On Sat, 2005-10-01 at 18:58 -0400, Ivan Shevanski wrote:
> To continue with my previous problems, now I'm trying out classes. But I
> have a problem (which I bet is easily solveable) that I really don't get.
> The numerous tutorials I've looked at just confsed me.For intance:
>
> >>>class Xyz:
Ivan Shevanski wrote:
> To continue with my previous problems, now I'm trying out classes. But
> I have a problem (which I bet is easily solveable) that I really don't
> get. The numerous tutorials I've looked at just confsed me.For intance:
>
class Xyz:
>
> ... def y(self):
> ...