[Tutor] The def command

Joseph J. Strout joe@strout.net
Wed, 13 Oct 1999 13:53:16 -0700


At 5:44 PM -0300 10/13/99, Alexandre Passos wrote:
>How can I use the def command to create an object?

You don't.  "def" is used to define functions.  To create an object, 
you just call the class name as if it's a function.  E.g.:

class Foo:
	def spam(self, n):
		print "spam "*n

myFoo = Foo()


HTH,
-- Joe

,------------------------------------------------------------------.
|    Joseph J. Strout           Biocomputing -- The Salk Institute |
|    joe@strout.net             http://www.strout.net              |
`------------------------------------------------------------------'