Graphs: Python - Building the Vertex II

This task made me realise that I don’t understand how the init constructor works.

What is self.value = value doing?
Is it saying that if I run it on an object, then a .value attribute is assigned to this object and the object’s “value attribute” will now be the same as the “value”?

If that is the case, then when:

grand_central.add_edge(forty_second_street.value)

is called, is it the same as writing:

grand_central.add_edge("42nd Street Station")

because both refer to the “42nd Street Station” vertex?

This is the code I use for the task:

class Vertex:
  def __init__(self, value):
    self.value = value
    self.edges = {}

  # define .add_edge() here

  def add_edge(self, vertex):
    print("Adding edge to " + vertex)
    self.edges[vertex] = True

  def get_edges(self):
    return list(self.edges.keys())

  
grand_central = Vertex('Grand Central Station')
forty_second_street = Vertex('42nd Street Station')

print(grand_central.get_edges())

# call .add_edge() below here
grand_central.add_edge(forty_second_street.value)


print(grand_central.get_edges())

Thanks!

Don’t see what that has to do with __init__
does it or does it not have that attribute?
you could read the code for the __init__, sounds like you’re asking about what code you have in your __init__ rather than anything that’s special about __init__