Skip to content

Commit

Permalink
Document differences better
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Nov 22, 2023
1 parent f18f8fc commit fb373f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Here's how `getfullargspec` is different from regular `signature` call:
>>> inspect.getfullargspec(A().method)
FullArgSpec(args=['self', 'arg'], varargs=None, varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={'return': None, 'arg': <class 'int'>})

>>> # signature() produces a different result:
>>> inspect.signature(A().method)
<Signature (arg: int) -> None>

Expand All @@ -62,9 +63,13 @@ FullArgSpec(args=['self', 'arg'], varargs=None, varkw=None, defaults=None, kwonl
>>> inspect.getfullargspec(func)
FullArgSpec(args=[], varargs='args', varkw='kwargs', defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={'return': None})

>>> # signature() produces a different result:
>>> inspect.signature(func)
<Signature (a: int, /, b: str) -> None>

```

Here's how you can migrate:
Here's how you can migrate, these results will be in line with `getfullargspec`:

```python
>>> import inspect313
Expand Down
2 changes: 1 addition & 1 deletion tests/test_signature.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import functools
import inspect
from typing import Any, TypeVar, Callable, cast
from typing import Any, Callable, TypeVar, cast

import pytest

Expand Down

0 comments on commit fb373f4

Please sign in to comment.