Skip to content

Add support for positional only params.#38

Merged
dnwpark merged 8 commits intomainfrom
positional-params
Jan 17, 2026
Merged

Add support for positional only params.#38
dnwpark merged 8 commits intomainfrom
positional-params

Conversation

@dnwpark
Copy link
Contributor

@dnwpark dnwpark commented Jan 15, 2026

No description provided.

@dnwpark dnwpark requested a review from msullivan January 15, 2026 02:54
@msullivan
Copy link
Collaborator

We already do support positional only params, by way of leaving the name empty. It wouldn't be terrible to do it via a qualifier though instead, I guess?

@msullivan
Copy link
Collaborator

I also just pushed (...without a PR) fb16d9d, which adds abbreviations for all the Param types

Comment on lines +590 to +591
if tp_head is staticmethod:
return typing.get_args(evaled)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This certainly does not strike me as right

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this was very not right, but was me ham fisting my way through staticmethod and classmethod not being subtypes of Callable.

class CMethod:
@classmethod
def cbase2(_arg0: type[tests.test_type_dir.CMethod], _arg1: int, /, a: bool | None) -> int: ...
def cbase2(cls: type[tests.test_type_dir.CMethod], lol: int, /, a: bool | None) -> int: ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh is part of the point here to be able to preserve these names?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, since we have them anyways, it's weird to just throw them away

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really part of the type anymore, though.
(Although arguably we keep other things like that...)

Copy link
Collaborator

@msullivan msullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update PosParam/PosNamedParam abbrevs also

@dnwpark
Copy link
Contributor Author

dnwpark commented Jan 17, 2026

Ok I looked into the weirdness and it's because Sub[staticmethod, Callable] is true, but Sub[classmethod, Callable] is false. Which makes sense, but it's still weird.

@dnwpark dnwpark merged commit 626d16f into main Jan 17, 2026
6 checks passed
@dnwpark dnwpark deleted the positional-params branch January 17, 2026 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants