You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The feedback on python-ideas suggests that people would like to have stubs always use the .pyi extension.
I am beginning to believe this is a good idea -- I know I've been confused between the stub and real version of a file at least twice so far (though both times it was the copy of types.py in the mypy repo, perhaps a special case :-).
Yeah, using the same extension for both can result in odd situations. I guess the assumption would be that editors and IDEs would eventually learn to recognize the .pyi extension (for syntax highlighting etc.), if it's specified in the PEP.
The only benefit I see in reusing .py is that editors and other tools don't have to adopt. I think that's a small benefit - editors should easily/quickly be able to do the minimum of just treating .pyi the same as .py in terms of syntax highlighting, etc.
Other than that, having a different file extension for stub files only makes sense to reduce confusion. Compare to C, and .c/.h files - even if I have them in a separate folder it'd be weird and confusing to have header files/stubs named .c as well.
Activity
JukkaL commentedon Mar 24, 2015
Yeah, using the same extension for both can result in odd situations. I guess the assumption would be that editors and IDEs would eventually learn to recognize the .pyi extension (for syntax highlighting etc.), if it's specified in the PEP.
The-Compiler commentedon Mar 24, 2015
The only benefit I see in reusing
.pyis that editors and other tools don't have to adopt. I think that's a small benefit - editors should easily/quickly be able to do the minimum of just treating.pyithe same as.pyin terms of syntax highlighting, etc.Other than that, having a different file extension for stub files only makes sense to reduce confusion. Compare to C, and
.c/.hfiles - even if I have them in a separate folder it'd be weird and confusing to have header files/stubs named.cas well.vlasovskikh commentedon Mar 24, 2015
+1 on .pyi only. It would be more clear for people that they are viewing / editing Python stubs, not the real Python files themselves.
gvanrossum commentedon Mar 26, 2015
Let's do it.