TypeScript has a similar concept: https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
Probably, this is the only similar reference I know.

ср, 14 сент. 2022 г. в 17:49, Irv Lustig <irv@princeton.com>:
I'm the leader of the pandas-stubs project.  In pandas, users can extend the library by creating their own accessor via `@pd.api.extensions.register_dataframe_accessor` (see https://pandas.pydata.org/docs/reference/api/pandas.api.extensions.register_dataframe_accessor.html).  So for a `DataFrame`, if you do `@pd.api.extensions.register_dataframe_accessor("xyz")`, you now have `DataFrame.xyz` returning the class you annotated.

Now suppose you want to create a stub for your new accessor, that would extend the existing pandas-stubs.  AFAIK, there isn't a way to do something like this in a stub:
```
from pandas import DataFrame
@typing.extend
class DataFrame:
    def xyz(self) -> MyXyzClass: ...
```
The idea here is that there is a class (in this case, `DataFrame`) that already has stubs, and you want to add a method to it.

Has this idea been discussed anywhere?
_______________________________________________
Typing-sig mailing list -- typing-sig@python.org
To unsubscribe send an email to typing-sig-leave@python.org
https://mail.python.org/mailman3/lists/typing-sig.python.org/
Member address: n.a.sobolev@gmail.com