Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Introduce AccountSet class #3

@kennell

Description

@kennell

Currently, the accounts property of a Wallet instance simply returns a list of Account instances.

I am thinking about implementing a holder class named AccountSet which contains a set of Account's and returning that as the Wallet accounts property. This would allow for a cleaner API in some cases, e.g. with such a class one could do things like:

wallet = Wallet(id='AAAABBBBCCCCDDDD')
new_acc = wallet.accounts.new()
acc = wallet.accounts['xrb_123123123123123']

And by implementing __iter__ or a generator it would still be possible to iterate over all accounts in a comfortable way as it is right now:

wallet = Wallet(id='AAAABBBBCCCCDDDD')
for a in wallet.accounts:
    print(a.balance)

Any input/ideas on this is appreciated @crolfe @jordancoil @jdistler

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions