Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 428 Bytes

code_style.md

File metadata and controls

21 lines (15 loc) · 428 Bytes

Code styles

type hints

  • for inputs, be flexible
  • for outputs, be strict
# recommended
def receives_address(address: Union[Base32Address, str]) -> Base32Address:
    return address

def receives_hash(hash: Union[_Hash32, str]) -> HexBytes:
    return hash

such style suit for conflux_web3.types, tests._test_helpers.type_check

Optional or | None

  • for inputs, use Optional
  • for outputs, use | None