Skip to content

Python watch_address uses bare list[str] type hint and = None default — should use Optional[List[str]] #452

@realfishsam

Description

@realfishsam

Inconsistency

watch_address in the Python SDK uses the bare list[str] generic (Python 3.9+ only) with a = None default. This is both a compatibility issue (breaks Python 3.8) and a type-correctness issue (list[str] does not include None, so the annotation is wrong for the given default).

Current (PMXT)

sdks/python/pmxt/client.py line ~2030:

def watch_address(self, address: str, types: list[str] = None):

Two problems:

  1. list[str] as a generic requires Python ≥ 3.9; the rest of the SDK imports List from typing for 3.8 compatibility.
  2. The annotation list[str] does not permit None, but the default is None. The correct annotation is Optional[List[str]].

Expected (CCXT convention)

CCXT Python uses typing.List and typing.Optional throughout for 3.8 compatibility. Consistent with the rest of sdks/python/pmxt/client.py and sdks/python/pmxt/models.py:

from typing import List, Optional

def watch_address(self, address: str, types: Optional[List[str]] = None):

Impact

Code using this method will fail to import or raise a TypeError on Python 3.8. Static type checkers (mypy) will flag the None default as incompatible with the list[str] annotation.


Found by automated PMXT ↔ CCXT API consistency audit

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions