newbie question

Colin J. Williams cjw at sympatico.ca
Thu Jan 1 21:47:55 CET 2004


You might look at your indentation.

The def __init__ line should have the same indentation as the preceding 
doc string.

Colin W.

Julia Osip wrote:

> Hi, just started fiddling around with python, having some difficulty
> getting the following small play program to execute.  Furious
> searching in the docs, manual, newsgroup did not avail me, does anyone
> have any ideas what might be the problem?  Some sort of whitespace
> issue (im still unsure of whitespace rules)?  I'm running Mac OS
> 10.2.8, with MacPython 2.3.
> 
> Thanks for any help you can give...
> 
> the code
> ...snip...
> #!/usr/bin/env python
> 
> class World:
> 
>     """contains everything"""
> 
> 	def __init__(self):
> 		self.name = "world"
> 		self.locations = []                     # list of all locations in
> the world
> 		self.dist_locations = []		# the amount of travel time required
> between locations
> 		self.actors = []				# list of all actors in the world
> 		self.organizations = []		# list of all organizations in the world
> 		self.time = 0				# current moment in the world
> 		return
> 
> ...snip...
> 
> the error
> ...snip...
>   File "<string>", line 7
>     def __init__(self):
>     ^
> SyntaxError: invalid syntax
> ...snip...




More information about the Python-list mailing list