MCPcopy Create free account
hub / github.com/dabeaz/python-cookbook / __init__

Function __init__

src/9/defining_classes_programmatically/example1.py:4–7  ·  view source on GitHub ↗
(self, name, shares, price)

Source from the content-addressed store, hash-verified

2
3# Methods
4def __init__(self, name, shares, price):
5 self.name = name
6 self.shares = shares
7 self.price = price
8
9def cost(self):
10 return self.shares * self.price

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected