Skip to content

Idea: allow assert with platform or version check at top of file #5308

Closed
@gvanrossum

Description

@gvanrossum

Some files only work for certain platforms, but sometimes it's inconvenient to move the file to a location where it'll only be picked up for that platform. And yet the file doesn't type check cleanly on another platform (or ditto for Python versions).

We could enclose the entire file in if sys.platform == 'win32': but that seems overkill (and adding the indentation makes for an awkward diff). I propose an alternative that would have the same effect: assert sys.platform == 'win32'.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions