python strings
Consultant (amrit@xvt.com)
Tue, 26 Apr 1994 11:01:37 -0600 (MDT)
> In my private version of what will soon be released as Python, 1.0.2
> at the cost of increasingly messy code in tokenizer.c, I've managed to
> implement triple-quoted strings, as well as backslash-continued
> strings and string literal concatenation as in C, and Donald Beaudry's
> %(name)format hack and the vars() function.
>
I don't really like the idea of having a zillion different ways to
write long strings. Since we have triple quotes now, I see little point
to backslash-continued strings or string literal concatenation.
Also, I wonder if the vars() function should return a dict of all
variables in scope, not just the local vars. For example:
>>> n = 2
>>> def g():
... i = 1
... print vars()
>>> g()
{'n': 2, 'i': 1}
That way, one could use the printf extensions brainlessly, (no need to worry
about where a symbol comes from)
i.e.
>>> n = 2
>>> def g():
... i = 1
... print "n = %{n}d and i = %{i}d.\n" % vars() # global & locals here
>>> g()
n = 2 and i = 1.