python-sdk icon indicating copy to clipboard operation
python-sdk copied to clipboard

Assign some methods as properties

Open HarukaMa opened this issue 2 years ago • 1 comments

Draft: depends on #18

Basically, to make the SDK more pythonic. Some methods like account.address() could be written as account.address, as arguably address is a property of account. IMO we don't really need to keep the Rust semantics here.

My criteria is:

  • Returned value could be seen as a property of the object
  • No other inputs needed to compute the value (see RecordPlaintext.serial_number_string)
  • The method is reasonably fast to execute
  • The method has no side effects

As a side note, to_string methods feels superfluous as users should just use str(...) in Python to get a string representation of the object. I decided to not removing those here though.

HarukaMa avatar Oct 28 '23 09:10 HarukaMa

need to review and reconsider if methods from new classes should be changed as well. draft for now.

HarukaMa avatar Dec 08 '23 14:12 HarukaMa