Is it possible to create an object of a class using objects of another class, for example:
class Node(object):
def __init__(self, name):
self.name = name
class Edge(object):
def __init__(self, name, node1, node2):
self.name = name
self.node1 = node1 #only if it is an object of Node
self.node2 = node2 #only if it is an object of Node
Hence an object of Edge will only be created if both node1 and node2 are objects of Node. Thanks