3 ms·
Single-quotes is the typical way to go. I do know when I'm not linting that I mix and match unintentionally. Easy to forget
by bpicolo 11y ago
Single-quotes is the typical way to go. I do know when I'm not linting that I mix and match unintentionally. Easy to forget
- illumen 11y agoI wish this was defined by pep8, but sort of glad it's not. Much python code uses single quotes, with double quotes for doc strings. Except where it is more convenient. More convenient places include structures when escaping strings. "Joe's easier here's why." Is better than 'Joe\'s easier here\'s why.' Also structures which are JSON structures too (makes copy/pasta easier).
- sago 11y agoAnother commenter articulated this, but my general style was single quotes on 'atoms' (e.g. mostly dictionary keys or set values), double quotes on anything intended to be read by a person. For that reason: to avoid \' all over. Though with py3, using alt-shift-] on my machine gives me ’, so I can do 'Joe’s easier, here’s why.'
- bpicolo 11y agoOr py2 via # -- coding: utf-8 --