Re:Ruff v0.16.0 – Significant new updates – 413 default rule...
by CuriouslyC on Sunday July 26, 2026 @08:38AM
(#49057538)
Using a consistent string delimiter has value: if you search for ['foo'] you will find all instances of the string foo. With inconsistent delimiters, you better have a single canonical 'foo' in your project or you're going to run into problems.
[ Parent
| on HN ]
Re:Ruff v0.16.0 – Significant new updates – 413 default rule...
by jason1cho on Sunday July 26, 2026 @12:04PM
(#49059491)
When a string contains strange characters, how do you enforce the single consistent delimiter?
You probably haven't written diverse enough code.
Re:Ruff v0.16.0 – Significant new updates – 413 default rule...
by maratc on Sunday July 26, 2026 @08:49AM
(#49057640)
See if you know where this leads before clicking on it: https://xkcd.com/208/
Re:Ruff v0.16.0 – Significant new updates – 413 default rule...
by CuriouslyC on Sunday July 26, 2026 @09:11AM
(#49057860)
So your argument is that your freedom to use whatever string delimiter you want (remember that ''', """, ` and even weird unicode glyphs are valid in many languages) is worth forcing other engineers on the team to know all valid string delimiters and remember to use the right regex to account for all possible weirdo choices?
Re:Ruff v0.16.0 – Significant new updates – 413 default rule...
by maratc on Sunday July 26, 2026 @09:14AM
(#49057883)
My argument is that searching for \bfoo\b will produce all the results you want.
Python was designed from the start so that 'foo' and "foo" are equal. It also worked like that for 30 years or so. This has not been an issue in these 30 years. But then someone came with an opinion that one of them is better than the other.
Re:Ruff v0.16.0 – Significant new updates – 413 default rule...
by CuriouslyC on Sunday July 26, 2026 @09:21AM
(#49057960)
\bfoo\b will produce noisy results. People have been pushing linting rules that force a single consistent choice of string delimiters since at least 2010 when Python went from a cute academic language to a real industry workhorse.
Re:Ruff v0.16.0 – Significant new updates – 413 default rule...
by maratc on Sunday July 26, 2026 @09:42AM
(#49058166)
> \bfoo\b will produce noisy results.
Add a look-behind for '[' and a look-ahead for ']' and you'll be fine.
Re:Ruff v0.16.0 – Significant new updates – 413 default rule...
by preg_match on Sunday July 26, 2026 @05:30PM
(#49062612)
The inverse is also true (speaking from PHP, I'm not 100% familiar with Python semantics). If we use '' where appropriate, then we know absolutely no escaping and no interpolation is done. That has value. If we use "" for everything, then we have to examine the string for interpolation or for escaping.