Browse Source

transaction.py: TxOutpoint: nicer __str__ and __repr__

useful e.g. when TxOutpoint is used as key in a dict (and the dict is printed)
patch-4
SomberNight 3 years ago
parent
commit
207600e00c
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 6
      electrum/transaction.py

6
electrum/transaction.py

@ -194,6 +194,12 @@ class TxOutpoint(NamedTuple):
return TxOutpoint(txid=bfh(hash_str),
out_idx=int(idx_str))
def __str__(self) -> str:
return f"""TxOutpoint("{self.to_str()}")"""
def __repr__(self):
return f"<{str(self)}>"
def to_str(self) -> str:
return f"{self.txid.hex()}:{self.out_idx}"

Loading…
Cancel
Save