> Does someone know if linters like pylint or pylakes current warn on
> "assert(test, msg)" statements?
I believe so, both the python itself (through SyntaxWarnings) and
other linters warn about this.
> Is it possible to run a code search on PyPI top 5000 projects to see
> if such always-true assertion is common or not?
I don't think this is a common thing, so changing the behavior should
not break anything. In my PyPI dataset (4 or 5 thousand packages),
I've only found 4 examples which 2 of them intentional (for test
purposes on linters/parsers etc). The other 2 seem like problematic
use cases, which should be fixed:
pylint
/home/isidentical/projects/data/pypi/clean/pylint/tests/functional/a/assert_on_tuple.py:4:0
keras-mxnet
/home/isidentical/projects/data/pypi/clean/keras-mxnet/examples/deep_dream.py:88:4
parso
/home/isidentical/projects/data/pypi/clean/parso/test/normalizer_issue_files/E12_not_first.py:54:4
/home/isidentical/projects/data/pypi/clean/parso/test/normalizer_issue_files/E101.py:38:1
django-modeltranslation
/home/isidentical/projects/data/pypi/clean/django-modeltranslation/modeltranslation/tests/urls.py:6:4
On Mon, Jan 10, 2022 at 2:35 PM Victor Stinner <[email protected]> wrote:
>
> Does someone know if linters like pylint or pylakes current warn on
> "assert(test, msg)" statements?
>
> If a project use such assertions which are always true, they can start
> failing wit the PEP 679, right? Hopefully, the fix is easy: removing
> the parenthesis give the same behavior on old and new Python versions.
>
> Is it possible to run a code search on PyPI top 5000 projects to see
> if such always-true assertion is common or not?
>
> Victor
>
> On Mon, Jan 10, 2022 at 1:22 AM Pablo Galindo Salgado
> <[email protected]> wrote:
> >
> > Hi everyone,
> >
> > I would like to start a discussion about a small PEP proposal to allow
> > parentheses in
> > assert statements to fix a common gotcha with assert statements.
> >
> > Link to the PEP: https://www.python.org/dev/peps/pep-0679/
> >
> > Please, redirect all discussions to:
> >
> > https://discuss.python.org/t/pep-679-allow-parentheses-in-assert-statements/13003
> >
> > as I will not be monitoring answers to this thread.
> >
> > Thanks, everyone for your time!
> >
> > Regards from cloudy London,
> > Pablo Galindo Salgado
> > _______________________________________________
> > Python-Dev mailing list -- [email protected]
> > To unsubscribe send an email to [email protected]
> > https://mail.python.org/mailman3/lists/python-dev.python.org/
> > Message archived at
> > https://mail.python.org/archives/list/[email protected]/message/I7MKCD3GHJXCERFCZ2FD3X7IPAX6ASVK/
> > Code of Conduct: http://python.org/psf/codeofconduct/
>
>
>
> --
> Night gathers, and now my watch begins. It shall not end until my death.
> _______________________________________________
> Python-Dev mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/LFQGI43BH3SWKHRBPO7T3DC6SEU5HMQ3/
> Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/2NJJM3ZNJOZJXFS67LPM2HM4MKKJJX3C/
Code of Conduct: http://python.org/psf/codeofconduct/