projects.insert({
'_id': "BedquiltDB",
'description': "A ghastly hack.",
'quality': "pre-alpha",
'tags': ["json", "postgres", "api"]
})
Does anyone actually mix quotes like this in python? It's horrible. projects.insert({
'_id': "BedquiltDB",
'description': "A ghastly hack.",
'quality': "pre-alpha",
'tags': ["json", "postgres", "api"]
})
Does anyone actually mix quotes like this in python? It's horrible.It's useful to be able to contain quotes in other quotes without escaping them.
i.e. '"hello there"' or "it's nice to see you"
Also, on many projects I've worked on, single quotes were for strings that were not meant to be shown to users (keys etc), and double quotes were for strings that would eventually be shown on a screen. It looks like that's what they're doing here.
Interesting, I've never seen that convention before.
In Ruby, I use single-quoted strings for things that can't possibly, by their nature, contain any string interpolation, to indicate that this is so; and then double-quoted strings for more arbitrary text that either contains interpolation, or might, in the future, get interpolation added. The coder here might be used to Ruby programming.
Though, also, it occurs to me that—since this is a dictionary that will become JSON—its type is {String => Object}. The single-quoted strings sort of read to me as indicating strings that couldn't be any other type; while the double-quoted strings are strings just because strings happen to be the response there, but could be any other object.
i can dig it. works decently as visual articulation.
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).
Though with py3, using alt-shift-] on my machine gives me ’, so I can do 'Joe’s easier, here’s why.'