I have a class named triangulo, and a class named coord. So, in a way to create a new instance of triangle, I pass three vertex like
t= triangle( V1, V2, V3)
So, for documentation, I want to write the class triangle in this way
class triangulo( object ):
def __init__(self, a:coord, b:coord, c:coord)->None:
"""Constructor
"""
self.A= a
self.B= b
self.C= c
class coord( object ):
def __init__( self, x, y ):
self.x= x
self.y= y
But when I try to import this library I get this error
NameError: name 'coord' is not defined
So the question is: How can I make python accept vertex as a type of data?
You need to declare the class before using it! so putting coord class on the top of triangulo will solve the problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With