PEP 526 introduced syntax for variable annotations, that can be added on an instance variable even when the value is not defined.
class BasicStarship:
captain: str = 'Picard' # instance variable with default
damage: int # instance variable without default
But when I list the instance variables, the one without value is not listed:
starship = BasicStarship()
dir(starship) #doesn't return 'damage' field
How can I get all instance variable, including the ones without value?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…