Problem with script and typing
Thaddeus L. Olczyk
olczyk at interaccess.com
Fri Jun 9 13:13:23 EDT 2000
Here goes ( extraneous pruned ):
project =[]
class Project:
def IsNull(self):
return self.name==""
project.append(self)
def FindProject(x):
for project in projects:
if project.name == x:
return x
null=Project("")
projects.remove(null)
def is_project(s):
if s[len(s)-3:] == 'prj':
project=FindProject(s)
## error here
if project.IsNull():
project=Project(s)
project.Scan()
----------
error message AttributeError: 'None' object has no attribute 'IsNull'
Several questions.
1) I've banged my head against this type of typing problem before.
How do I get around it?
2) Is there a better way of handling null objects? ( Most languages I
know have objects which are explicitly null )
More information about the Python-list
mailing list