So, I was writing an event emitter class using Python.
Code currently looks like this:
from typing import Callable, Generic, ParamSpec
P = ParamSpec('P')
class Event(Generic[P]):
def __init__(self):
...
def addHandler(self, action : Callable[P, None]):
...
def removeHandler(self, action : Callable[P, None]):
...
def fire(self, *args : P.args, **kwargs : P.kwargs):
...
And while it works good in Python 3.10 (on my machine), it fails in Python 3.9 and older (on other machines) because ParamSpec is a new feature.
So, how could I not import ParamSpec when running program, while not confusing typing in editor (pyright)?