In Python you don’t need to declare the variables by type, you simply define them in the scope that you need them. Other than that, the variables behave like in every other language.
In Python classes, there are also no private, public, or protected attributes and/or methods.
Everything is basically public, but what is often done for legibility is that supposedly private symbol names have an underscore as prefix (e.g.
self._private_variable = 10). That’s purely visual though and not mandatory.
Since, there is no privacy so to speak, you also don’t really need get- or set-methods, expect maybe for code structuring. You simply can access every attribute or method by its description (e.g.
You seem to be on the right track.
Here’s an example on how I would probably do this:
import Rhino.Geometry as rg
"""Default constructor initialises this class"""
self._pt = rg.Point3d.Origin # _pt is a "private" attribute
"""Returns the z-coordinate of _pt."""
if __name__ == "__main__":
sc = SomeClass() # instatiate a class instance
print( sc.get_zval() )
# Alternatively :
print( sc._pt.z ) # only fake private