Few Basic ideas of CORE Features in Python

Protocol Based Data Model: -

__name__ == ‘__main__’: -

#1st Page
if __name__ == ‘__main__’:
print "Run Directly"
else:
print "Run From Import
#2nd
import first module
print "Second Module's Name: {}".format(__name__)

Metaclasses: -

@property: -

class Property:def __init__(self, var):## initializing the attributeself.a = var@propertydef a(self):return self.__a## the attribute name and the method name must be same which is used to set the value for the attribute@a.setterdef a(self, var):if var > 0 and var % 2 == 0:self.__a = varelse:self.__a = 2## creating an object for the class 'Property'obj = Property(23)print(obj.a)

I hope to never stop Learning!