[Python-Dev] Re: Suggested changes to PEP 215

Jason Orendorff jason@jorendorff.com
Mon, 14 Jan 2002 21:46:38 -0600


Ping wrote:
> > Consider:
> >
> >     def f(str):
> >         # The argument 'str' masks the builtin str() function.
> >         a, b = find_stuff(str)
> >         print $'a = $a, b = $b'
> >         return a, b
> >
> > It should be specified that $-strings do not use the local
> > "str" and "unicode" names to find str() and unicode()
> 
> Good point.  Perhaps it is better to simply describe a
> transformation using '%s' and '%' instead of 'str' and '+'
> to avoid this potential confusion altogether.

I thought about this; but I don't know if there's a '%'
equivalent for the unicode handling.

$u'uni${a}ode'
    ---> (u'uni' + unicode(a) + u'ode')
    ---> u'uni%???ode' % (a,)

I don't think %s does it.  Maybe there's some format spec
flag that I'm forgetting.

## Jason Orendorff    http://www.jorendorff.com/