def __init__(self, name): "The Art of Computer Programming" by Donald E. Knuth
(Original Review, 2011)
Here's my code and a sample run attempting to find the shortest path from "Home" to "School":
class Location:
def __init__(self, name):
self.name = name
self.connections = []
def set_connections(self, connections):
self.connections = connections
def __str__(self):
return self.name
If you're into stuff like this, you can read the full review.