[issue36624] cleanup the stdlib and tests with regard to sys.platform usage

Michael Felt report at bugs.python.org
Mon Apr 15 10:14:32 EDT 2019


Michael Felt <aixtools at felt.demon.nl> added the comment:

On 15/04/2019 11:50, STINNER Victor wrote:
> STINNER Victor <vstinner at redhat.com> added the comment:
>
> support.is_android has two flaws:
>
> * it's a constant: it must be spelled as UPPER CASE
> * I dislike "is_" prefix: "MS_WINDOWS" constant is commonly used, and it doesn't start with "is_".

I do not like the is_xxx form either, but I am low in the (name) picking
order. I like ALL_CAPS because it is easier to recognize as a constant,

I have the habit of using _ (underscore) before a name - but the clear
consensus is to not use that for constants coming from support.test.

As to being 'backported', even manually - that is something I would work
on. I am an old dog - and this seems like a good enough bone for me.

So, I'll finish up for AIX - except I would like to underline again
something I have come across a few times (but cannot find right now) -
and that is to base these constants not on the platform being built on,
but the platform being run on (i.e., platform.system()). I expect there
may be specific tests that are relevant during the build moment, or
perhaps, "later", when using something such as 'pip' to add a module.

As, relatively speaking, a new-comer to Python, I see this as a vast
improvement to the readability (and clarity) of the code.

As to new tests, modifications, etc. it will become part of the PR
review to be sure this becomes and stays the standard.

Anyway, I'll get started with AIX - not that many - and I hope with all
the constant definitions being moved to one place that should simplify
maintenance (and perhaps even back-porting).

>
> In my PR, I used support.ANDROID.
>
> ----------
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <https://bugs.python.org/issue36624>
> _______________________________________
>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36624>
_______________________________________


More information about the Python-bugs-list mailing list