choice between quotes thoughts

Andrei Kulakov sill at optonline.net
Thu Aug 9 16:55:21 CEST 2001


On Thu, 9 Aug 2001 15:32:09 +0400 (MSD), Roman Suzi <rnd at onego.ru> wrote:
> Hello!
> 
> After some time working with Python I noticed that
> I use "-s and '-s according to the following rule:
> 
> I use "" quotes when I specify value MANUALLY. That is, in
> most cases.
> On the other hand, I use '' where quotes are generated
> automatically. This is consistent with repr(), which
> gives ''.
> 
> The same rules differenciate """ and '''.
> 
> Exception is made when I use '' to put single " inside, like in:
> '"'
> and also sometimes I use ' ' to specify literal constants which belong to
> some definite set, required by some function, like 'exec', 'eval',
> 'single' to compile().
> 
> And ever more rarely I still use ' ' to specify single character, when I
> want to emphasize compatibility with C.
> 
> I wonder if there are idiomatic differences between quotes, but
> who knows? (apart from cases mentioned in the Style Guide)
> 
> 
> Sincerely yours, Roman Suzi

I used to use '-s almost everywhere, but once I looked at them in the console..
they look ugly! Ever since, I use "-s except for single chars or to escape
"-s.

-- 
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: http://silmarill.org/cymbaline



More information about the Python-list mailing list