suppose you've created vector class to represent two-dimensional vectorswhat happens when you use the plus operator to add themmost likely python will yell at you you couldhoweverdefine the __add__ method in your class to perform vector addition and then the plus operator would behave as per expectationexample#!/usr/bin/python class vectordef __init__(selfab)self self def __str__(self)return 'vector (% % )(self aself bdef __add__(self,other)return vector(self other aself other bv vector( , vector( ,- print when the above code is executedit produces the following resultvector( , data hiding an object' attributes may or may not be visible outside the class definition for these casesyou can name attributes with double underscore prefixand those attributes will not be directly visible to outsiders example#!/usr/bin/python class justcounter__secretcount def count(self)self __secretcount + print self __secretcount counter justcounter(counter count(counter count(print counter __secretcount when the above code is executedit produces the following result traceback (most recent call last)file "test py"line in print counter __secretcount attributeerrorjustcounter instance has no attribute '__secretcountpython protects those members by internally chang ing the name to include the class name you can access such attributes as object _classname__attrname if you would replace your last line as following then it would work