Re: ✘Python broken %

2016-09-08 Thread Eric S. Raymond
Gary E. Miller : > Yo All! > > Yet another undocumented Python failure: > > i>>> d = {} > >>> d[1] = "one" > >>> d[2] = "two" > >>> str(d[2]) > 'two' > >>> echo "%s(d[2])s" % locals > File "", line 1 > echo "%s(d[2])s" % locals >^ > SyntaxError: invalid

Re: Python broken %

2016-09-08 Thread Hal Murray
> Python says %s(x)s works for any x that str(x) works. That's now how I read it. I didn't find any hints that %s takes its arg as (x) directly following the %s. The format of the % stuff is "string with %s and such" % arg or (args) The arg you want to print goes on the right of the %

✘Python broken %

2016-09-08 Thread Gary E. Miller
Yo All! Yet another undocumented Python failure: i>>> d = {} >>> d[1] = "one" >>> d[2] = "two" >>> str(d[2]) 'two' >>> echo "%s(d[2])s" % locals File "", line 1 echo "%s(d[2])s" % locals ^ SyntaxError: invalid syntax Python says %s(x)s works for any x that str(x)