Closed glourencoffee closed 2 years ago
This feature was implemented in a slightly different way than proposed. Instead of having many attributes in the class DMPL
for each column, attributes were created in a new class DMPLAccount
:
@dataclasses.dataclass(init=True)
class DMPLAccount(BaseAccount):
share_capital: int
...
consolidated_equity: typing.Optional[int]
DMPLAccount
is similar to Account
, with the difference being that Account.quantity
is replaced with each column of a DMPL statement, that is, DMPLAccount.share_capital
, DMPLAccount.consolidated_equity
, etc.
This implementation was preferred over the initially proposed one because it results in a simpler and clearer usage. Compare:
dmpl = DMPL(...)
count = len(dmpl.equity)
for i in range(count):
dmpl.share_capital[i]
dmpl.equity[i]
...
with:
dmpl = DMPL(...)
for account in dmpl.accounts:
account.share_capital
account.equity
Description
As a library user, I want to read columns of a DMPL statement as known attributes instead of looking up its full name.
Challenge
Having to access accounts of a DMPL column by its full name, which may raise
KeyError
.Benefit
Ease of use, explicitness
Acceptance criteria
DMPL
has attributes mapping to column namesAdditional context
In order to read accounts from a column in the DMPL, I have to specify its full name:
I want it to be like this: