-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Single quotes (') or double quotes (") #4
Comments
I prefer to use only double quotes for the triple-double-quotes of docstrings and single quotes everywhere else, but wouldn't mind your proposed exception. What if for some reason the string must contain double quotes? Do we escape it in this case? I do understand that you'd like to avoid escape sequences in strings. |
Valid point. While only double quotes in a single quoted string aren't a problem with above strategy print('foo has the value "bar"') mixing them would be. print('foo\'s value is "bar"') |
I prefer double quotes (solo and triple) everywhere. I use them in handwriting, I use them in other languages if allowed. It's 90% muscle memory, so I could re-learn and use single quotes just as well, but 10% useful for what I think is still a common case: communicating with the user in plain English. Following your proposal, |
Two random data points to fuel the flame war:
|
I must admit that I loosely have been using the style that you'd rather not consider. Single words are almost like single characters whereas phrases..., right? :) Anyway, I'm fine with Albert's proposal too (double quotes everywhere), as long as we have some policy. |
For whatever reason, I’ve been using single quotes essentially everywhere (unless they’re in the string, in which case I either escape or use double quotes). I think Vlad and I more or less have the same approach. I, too, don’t mind changing, if it’s in the name of a consistent lab style, whether it’s almost always single or almost always double.
|
Starting with #21 we mandate Google Style Guide and recommend PEP8, both of which only recommend to pick one quote-style and stick with it, unless it requires a lot of escapes in a given string, then it's okay to use the other. I think we should state a clear preference for either of them in the |
In Python single quotes (
'
) and double quotes can be used ("
) interchangeably to designate strings. While our code-style-guidelines suggest to use triple-double-quotes ("""
) for docstrings, we don't have a policy for normal strings.Please participate in this discussion to help us promote quote consistency in our projects!
I'd like to start the discussion with the following suggestion:
The text was updated successfully, but these errors were encountered: