string literal vs string variable
zuo at chopin.edu.pl
Sat Aug 22 23:06:57 CEST 2009
22-08-2009 o 19:46:51 Kee Nethery <kee at kagi.com> wrote:
> I'm not sure I know the difference between a string variable and a
> literal string. Is the difference as simple as:
> somestring = u'<stuff>hello world</stuff>'
> fromstring(somestring) <-- string variable
> XML(u'<stuff>hello world</stuff>') <-- literal string
s = 'hello world'
# it is a *string literal*
s # <- it is a *string object*
# (or rather a name referring to it :-))
(In Python we have rather 'names' than 'variables', though -- as
a mental leap -- they are commonly referred to as 'variables',
regarding other languages' terminology).
Jan Kaliszewski (zuo) <zuo at chopin.edu.pl>
More information about the Python-list