Hi, I have a class which I like to test using interactive shell but it seems that I’m unable to paste the code inside the shell without getting unexplainable IndentationError or that only part of the pasted code seems to register. The same code works if I paste it inside the interactive shell in pyCharm. Any ideas?
Here is my class:
class Circle(object):
"""You can document your class like so"""
# class object attribute
pi = 3.14
def __init__(self, radius=1):
self.radius = radius
def __str__(self):
return "A circle with radius of {}\n".format(self.radius)
def __len__(self):
return self.radius * 2
def __del__(self):
print "Circle deleted!\n"
def area(self):
""" radius**2 * pi"""
return (self.radius**2) * Circle.pi
def set_radius(self, new_radius):
"""Sets new radius"""
self.radius = new_radius