[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Python 'strings'
From: |
Bruno Haible |
Subject: |
Re: Python 'strings' |
Date: |
Sun, 25 Feb 2024 13:02:08 +0100 |
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 where the literal string 'foo' occurs, I don't want to make 2
searches (for 'foo' and for "foo"), nor a regex search (for ['"]foo['"]).
Simple things should remain simple. A certain canonical way to denote
literal strings is necessary for this. (Btw, JavaScript has the same
problem.)
* The Python interpreter prints strings with single-quotes:
>>> "abc"
'abc'
So, that makes the single-quotes the natural choice.
Bruno
- Re: Python != None, (continued)
- Re: Python != None, Bruno Haible, 2024/02/25
- Re: Python != None, Collin Funk, 2024/02/25
- Re: Python != None, Collin Funk, 2024/02/25
- Re: pycodestyle configuration, Bruno Haible, 2024/02/26
- Re: pycodestyle configuration, Collin Funk, 2024/02/26
- Re: pycodestyle configuration, Bruno Haible, 2024/02/26
- Re: pycodestyle configuration, Collin Funk, 2024/02/26
- Re: pycodestyle configuration, Bruno Haible, 2024/02/26
- Re: pycodestyle configuration, Collin Funk, 2024/02/26
- Re: Python != None, Dima Pasechnik, 2024/02/25
- Re: Python 'strings',
Bruno Haible <=
- Re: Python 'strings', Collin Funk, 2024/02/25
- Re: gnulib-tool.py: Follow gnulib-tool changes, part 28., Bruno Haible, 2024/02/24
- Re: gnulib-tool.py: Follow gnulib-tool changes, part 28., Collin Funk, 2024/02/24
- Re: gnulib-tool.py: Follow gnulib-tool changes, part 28., Collin Funk, 2024/02/24
- Re: gnulib-tool.py: Follow gnulib-tool changes, part 28., Bruno Haible, 2024/02/24
- Re: gnulib-tool.py: Follow gnulib-tool changes, part 28., Collin Funk, 2024/02/24
- Re: gnulib-tool.py: Follow gnulib-tool changes, part 28., Bruno Haible, 2024/02/26
- Re: gnulib-tool.py: Follow gnulib-tool changes, part 28., Collin Funk, 2024/02/28
- Re: gnulib-tool.py: Follow gnulib-tool changes, part 28., Bruno Haible, 2024/02/28