MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / __init__

Method __init__

example_code/item_081.py:120–123  ·  view source on GitHub ↗
(self, max_rating)

Source from the content-addressed store, hash-verified

118print("Example 7")
119class RatingInternal:
120 def __init__(self, max_rating):
121 assert max_rating > 0, f"Invalid {max_rating=}"
122 self.max_rating = max_rating
123 self.ratings = []
124
125 def rate(self, rating):
126 assert 0 < rating <= self.max_rating, f"Invalid {rating=}"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected