Re: Chapter 9 Tutorial for Classes Not Working
- From: Fredrik Lundh <fredrik@xxxxxxxxxxxxxx>
- Date: Fri, 30 Jun 2006 17:13:01 +0200
Tom Grove wrote:
I am trying the classes example from the tutorial because some other class related stuff I am doing is not working either.>
Straight from Chapter 9:
class MyClass:
"A simple example class"
i = 12345
def f(self):
return 'hello world'
From here I run:
x = MyClass
the tutorial says:
Class instantiation uses function notation. Just pretend that the
class object is a parameterless function that returns a new
instance of the class. For example (assuming the above class):
x = MyClass()
creates a new instance of the class and assigns this object to the
local variable x.
</F>
.
- Prev by Date: Re: Way for see if dict has a key
- Next by Date: Re: Chapter 9 Tutorial for Classes Not Working
- Previous by thread: Re: Chapter 9 Tutorial for Classes Not Working
- Next by thread: VPW: early registration deadline today!
- Index(es):
Relevant Pages
|