@@ -615,8 +615,8 @@ class Ontology(AnnotatableTerms):
615615
616616 def __init__ (self , identifier = None , imports = None , comment = None , graph = None ):
617617 super (Ontology , self ).__init__ (identifier , graph )
618- self .imports = imports and imports or []
619- self .comment = comment and comment or []
618+ self .imports = [] if imports is None else imports
619+ self .comment = [] if comment is None else comment
620620 if (self .identifier , RDF .type , OWL .Ontology ) not in self .graph :
621621 self .graph .add ((self .identifier , RDF .type , OWL .Ontology ))
622622
@@ -959,12 +959,12 @@ def __init__(
959959 ):
960960 self .graph .add ((self .identifier , RDF .type , OWL .Class ))
961961
962- self .subClassOf = subClassOf and subClassOf or []
963- self .equivalentClass = equivalentClass and equivalentClass or []
964- self .disjointWith = disjointWith and disjointWith or []
962+ self .subClassOf = [] if subClassOf is None else subClassOf
963+ self .equivalentClass = [] if equivalentClass is None else equivalentClass
964+ self .disjointWith = [] if disjointWith is None else disjointWith
965965 if complementOf :
966966 self .complementOf = complementOf
967- self .comment = comment and comment or []
967+ self .comment = [] if comment is None else comment
968968
969969 def _get_extent (self , graph = None ):
970970 for member in (graph is None and self .graph or graph ).subjects (
@@ -1306,7 +1306,7 @@ class OWLRDFListProxy(object):
13061306 def __init__ (self , rdfList , members = None , graph = None ):
13071307 if graph :
13081308 self .graph = graph
1309- members = members and members or []
1309+ members = [] if members is None else members
13101310 if rdfList :
13111311 self ._rdfList = Collection (self .graph , rdfList [0 ])
13121312 for member in members :
@@ -1418,7 +1418,7 @@ def isPrimitive(self):
14181418
14191419 def __init__ (self , identifier = None , members = None , graph = None ):
14201420 Class .__init__ (self , identifier , graph = graph )
1421- members = members and members or []
1421+ members = [] if members is None else members
14221422 rdfList = list (self .graph .objects (predicate = OWL .oneOf , subject = self .identifier ))
14231423 OWLRDFListProxy .__init__ (self , rdfList , members )
14241424
@@ -1985,7 +1985,7 @@ def __init__(
19851985 self .inverseOf = inverseOf
19861986 self .domain = domain
19871987 self .range = range
1988- self .comment = comment and comment or []
1988+ self .comment = [] if comment is None else comment
19891989
19901990 def serialize (self , graph ):
19911991 for fact in self .graph .triples ((self .identifier , None , None )):
0 commit comments