Jan-26-2022, 07:29 PM
__init__ not __int__. Hard to see because you often see what you expect to see, not what is really there.
If an attribute created in __init__() is not in the object, test if __init__() is called.
If an attribute created in __init__() is not in the object, test if __init__() is called.
class Portfolio: def __int__(self): print("Enter __init__()") self.holdings = {} #key = ticker, Value = number of shares print("Leave __init__()")When I created a Portfolio object it didn't print anything. That means __init__() wasn't called. Knowing that it didn't take long to find the error.