Modernize code to Python 3.6+ and some cleanup
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
"""
|
||||
>>> import copy
|
||||
>>> bus1 = Bus(['Alice', 'Bill', 'Claire', 'David'])
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
>>> import weakref
|
||||
>>> stock = weakref.WeakValueDictionary()
|
||||
>>> catalog = [Cheese('Red Leicester'), Cheese('Tilsit'),
|
||||
... Cheese('Brie'), Cheese('Parmesan')]
|
||||
... Cheese('Brie'), Cheese('Parmesan')]
|
||||
...
|
||||
>>> for cheese in catalog:
|
||||
... stock[cheese.kind] = cheese
|
||||
@@ -24,5 +24,5 @@ class Cheese:
|
||||
self.kind = kind
|
||||
|
||||
def __repr__(self):
|
||||
return 'Cheese(%r)' % self.kind
|
||||
return f'Cheese({self.kind!r})'
|
||||
# end::CHEESE_CLASS[]
|
||||
|
||||
Reference in New Issue
Block a user