Repository navigation
Change empty string literals to ellipsis - #377
Conversation
For pytype compatibility
|
Should that be |
|
It would be better to add |
|
for all I know, some of those functions accept non-str types, so I didn't want to introduce changes. But if you're both ok with a str annotation then will add them |
|
A fair point -- it's actually not trivial to see whether |
|
could mypy give different errors for these two stubs? def f(a=''): ... I believe for pytype they're equivalent, I think the only literals that we get type information from (in stubs) are None, ints and floats |
|
Looks like for mypy they're equivalent.
|
|
They are equivalent. The reason why stubs have non-empty default values is often due to the mypy stubgen utility. It generates function stubs with default argument values to make it easier to manually annotate stubs. Often the default value gives a hint about the type of the argument. For example, if it's |
|
Would it be possible to tweak stubgen to generate a comment instead, or something along those lines? |
|
Sure, it shouldn't be hard. As mypy is happy with the literals there hasn't been much of an incentive until now. |
For pytype compatibility