File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,10 @@ are going to be processed. A simple dictionary will do.
99>>> from stock_alerter.stock import Stock
1010>>> exchange = {"GOOG": Stock("GOOG"), "AAPL": Stock("AAPL")}
1111>>> for key in sorted(exchange.keys()):
12- ... print(key, exchange[key])
12+ ... print(key, str( exchange[key]) )
1313...
14- AAPL <stock_alerter.stock. Stock object at 0x0...>
15- GOOG <stock_alerter.stock. Stock object at 0x0...>
14+ AAPL Stock("AAPL")
15+ GOOG Stock("GOOG")
1616
1717Next, we configure the reader. The reader is the source from where the
1818stock updates are coming. The module provides two readers out of the
Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ def __init__(self, symbol):
2020 self .history = TimeSeries ()
2121 self .updated = Event ()
2222
23+ def __str__ (self ):
24+ class_name = type (self ).__name__
25+ return '{}("{}")' .format (class_name , self .symbol )
26+
2327 @property
2428 def price (self ):
2529 """Returns the current price of the Stock
You can’t perform that action at this time.
0 commit comments