Re: Python != None

2024-02-25 Thread Dima Pasechnik
On Sun, Feb 25, 2024 at 11:29:51AM -0800, Collin Funk wrote: > On 2/25/24 3:57 AM, Bruno Haible wrote: > > The style warnings about "!= None" in pycodestyle and/or pylint are > > relativized by this warning in Python itself: > > > > >>> '' != None > > True > > >>> '' is not None > > :1: Sy

Re: Python != None

2024-02-25 Thread Collin Funk
On 2/25/24 11:29 AM, Collin Funk wrote: > I would hope that it just > involves a simple configuration file that takes the options we have at > the top of gnulib-tool.py. Adding the two attached files to the root directory of gnulib should adjust the warnings to the agreed upon coding style (as far

Re: Python != None

2024-02-25 Thread Collin Funk
Hi Bruno, On 2/25/24 3:57 AM, Bruno Haible wrote: > The style warnings about "!= None" in pycodestyle and/or pylint are > relativized by this warning in Python itself: > > >>> '' != None > True > >>> '' is not None > :1: SyntaxWarning: "is not" with a literal. Did you mean "!="? > True

Re: Python 'strings'

2024-02-25 Thread Collin Funk
Hi Bruno, On 2/25/24 4:02 AM, Bruno Haible wrote: > * The Python interpreter prints strings with single-quotes: > > >>> "abc" > 'abc' > > So, that makes the single-quotes the natural choice. Interesting find. I don't have super strong feelings on the matter. I just think that it is best tha

bitset: Don't access errno when it's not set

2024-02-25 Thread Bruno Haible
The 'bitset' module accesses an undefined errno in two situations: 1) After calling fread() that reads fewer elements than requested, and after calling ferror(), the value of errno is undefined.[1][2] 2) After calling fclose() on native Windows, the value of errno is undefined. [3][4][5] [1]

bitset: Avoid newlines at the end of translatable strings

2024-02-25 Thread Bruno Haible
Except in particular situations (such as --help messages, where each translatable string ends with a newline), it is not a good idea to include a newline at the end of a translatable string, because: - The decision to add a newline after a certain text is a programmer's decision; if the tran

Re: Python 'strings'

2024-02-25 Thread Bruno Haible
Summarizing the rationale to use 'abc' as string syntax: * PEP 8 https://peps.python.org/pep-0008/#string-quotes says "In Python, single-quoted strings and double-quoted strings are the same. This PEP does not make a recommendation for this. Pick a rule and stick to it." * When I search whe

Re: Python != None

2024-02-25 Thread Bruno Haible
Collin Funk wrote: > One thing that annoys me personally > is comparing to none using "!=" instead of "is not". This is > recommended against in PEP 8, "Comparisons to singletons like None > should always be done with is or is not, never the equality > operators." [1]. Dima Pasechnik wrote: > The