choice between quotes thoughts
Roman Suzi
rnd at onego.ru
Thu Aug 9 07:32:09 EDT 2001
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
--
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Thursday, August 09, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "NEWS! Stolen painting found by tree" _/
More information about the Python-list
mailing list