6 ms·
I 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 co
by illumen 10y ago
I 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 10y 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 10y agoOr py2 via # -- coding: utf-8 --