python – TypeError: bool object is not callable
python – TypeError: bool object is not callable
You do cls.isFilled = True
. That overwrites the method called isFilled
and replaces it with the value True. That method is now gone and you cant call it anymore. So when you try to call it again you get an error, since its not there anymore.
The solution is use a different name for the variable than you do for the method.
Actually you can fix it with following steps –
- Do
cls.__dict__
- This will give you dictionary format output which will contain
{isFilled:True}
or{isFilled:False}
depending upon what you have set. - Delete this entry –
del cls.__dict__[isFilled]
- You will be able to call the method now.
In this case, we delete the entry which overrides the method as mentioned by BrenBarn.