object() Return a new featureless object. It has the methods that are common to all instances of Python classes
x=object()
print(type(x)) # <class 'object'>
class student_kit():
college_name='ABC College' #class attributes
#instance attributes
def __init__(self,name,section):
self.name= name
self.section=section
self.height=5 #instance attribute
Alex=student_kit('Alex','A') # object declaration
print(Alex.name,Alex.section,Alex.height)
Alex()
The last line will generate error like this.
TypeError: 'student_kit' object is not callable
class student_kit():
college_name='ABC College' #class attributes
#instance attributes
def __init__(self,name,section):
self.name= name
self.section=section
self.height=5 #instance attribute
def __call__(self):
print('Hi , you called me')
Alex=student_kit('Alex','A') # object declaration
print(Alex.name,Alex.section,Alex.height)
Alex()
Output
Alex A 5
Hi , you called me
Here we have added __call__(self) so we can use Alex().
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.