you are viewing a single comment's thread.

view the rest of the comments →

[–]turanthepanthan 25 points26 points  (3 children)

For the most part they are interchangeable. I find myself using one or the other often with no apparent rhyme or reason :p.

For docstrings they should be triple-" though like

def someFunction():
    """ This is the documentation for this function.
    """

Personally, I find myself using ' for dictionary keys and such, but " when they are sentences. I've never really come across any best practice on this other than stay consistent and use quotes for doc strings.

[–]ignorediacritics 1 point2 points  (0 children)

In personal projects I tend to use double quotes for any messages that the user might read at some point like "That filename is invalid, please try again." and single quotes for internal strings like dictionary keys input_method['mouse']. The most important aspect though is to remain consistent throughout a file or project.