Supporting sys.platform.startswith in type checkers

Hello, I've been directed here from the typeshed community. Currently none of the type checkers and pyi linters support startswith with regards to sys.platform. It is however necessary for some more precise definitions for platform dependent constants - the sys.platform value for openbsd is openbsd{version} so comparison alone is not enough. Note that this is the recommended way to check for these other operating systems in the docs. Examples for such constants: mmap.ADV_* time.CLOCK_PROF time.CLOCK_UPTIME While obviously not a high priority issue, I'd still like to hear opinions. Thanks, Tal.

How many openbsd versions are there that matter for this purpose? IIRC you can use `sys.platform in ('openbsd1', 'openbsd2', 'openbsd3')`. If there are only a few that would work without changing the static type checkers (there are so many of those now that it would be a bit of a pain to get all of them to support such a new feature). On Wed, May 5, 2021 at 12:06 AM Sebastian Rittau <srittau@rittau.biz> wrote:
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...>

6 for openbsd: https://en.wikipedia.org/wiki/OpenBSD_version_history 7 for NetBsd: https://www.netbsd.org/releases/formal.html Some ARE pretty old though. Most of the implications here is that type checkers will know to avoid definitions meant for those operating systems without needing to change the stubs when a new OS comes out + being less verbose than mentioning each os version.

How many openbsd versions are there that matter for this purpose? IIRC you can use `sys.platform in ('openbsd1', 'openbsd2', 'openbsd3')`. If there are only a few that would work without changing the static type checkers (there are so many of those now that it would be a bit of a pain to get all of them to support such a new feature). On Wed, May 5, 2021 at 12:06 AM Sebastian Rittau <srittau@rittau.biz> wrote:
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...>

6 for openbsd: https://en.wikipedia.org/wiki/OpenBSD_version_history 7 for NetBsd: https://www.netbsd.org/releases/formal.html Some ARE pretty old though. Most of the implications here is that type checkers will know to avoid definitions meant for those operating systems without needing to change the stubs when a new OS comes out + being less verbose than mentioning each os version.
participants (3)
-
Guido van Rossum
-
Sebastian Rittau
-
talhayon1@gmail.com