annotations are very new feature of pythonand because python does not impose any predefined meaning on themthe uses they can be put to are limited only by our imagination further ideas for possible usesand some useful linksare available from pep "function annotations"www python orgdev/peps/pep- further object-oriented programming ||in this section we will look more deeply into python' support for object orientationlearning many techniques that can reduce the amount of code we must writeand that expand the power and capabilities of the programming features that are available to us but we will begin with one very small and simple new feature here is the start of the definition of point class that has exactly the same behavior as the versions we created in class point__slots__ (" "" "def __init__(selfx= = )self self attribute access functions when class is created without the use of __slots__behind the scenes python creates private dictionary called __dict__ for each instanceand this dictionary holds the instance' data attributes this is why we can add or remove attributes from objects (for examplewe added cache attribute to the get_function(function earlier in this if we only need objects where we access the original attributes and don' need to add or remove attributeswe can create classes that don' have __dict__ this is achieved simply by defining class attribute called __slots__ whose value is tuple of attribute names each object of such class will have attributes of the specified names and no __dict__no attributes can be added or removed from such classes these objects consume less memory and are faster than conventional objectsalthough this is unlikely to make much difference unless large numbers of objects are created if we inherit from class that uses __slots__ we must declare slots in our subclasseven if emptysuch as __slots__ ()or the memory and speed savings will be lost controlling attribute access |it is sometimes convenient to have class where attribute values are computed on the fly rather than stored here' the complete implementation of such class