Posts

Why is the print statement in the class executed when an object isn't even created?

Image
1 When I run the code below the output is "hello". However, the print statement is part of the class pl , and i never created an instance of the class pl , so why is the print statement being executed? class pl: def __init__(self,a,b): self.aa=a self.bb=b print("hello") python python-3.x class share | improve this question edited Nov 22 at 18:59 timgeb 48.8k 11 63 90 asked Nov 22 at 17:50 user3124200 70 4 ...