[Python-3000] Proposed changes to PEP3101 advanced string formatting -- please discuss and vote!
Patrick Maupin
pmaupin at gmail.com
Wed Mar 14 01:50:27 CET 2007
On 3/13/07, Josiah Carlson <jcarlson at uci.edu> wrote:
>
> Sounds far too implicit to me. I would much prefer a completely
> different syntax. Having just had a patch that implements Windows shell
> variable expansion as $var, ${var} and %var% (the last being new), I
> can't help but think that %var% would be a better alternate explicit
> syntax than the 'space follows {' implicit syntax you are offering.
I think the syntax could be considered 'subtle', but I'm not really
sure about how it is 'implicit' -- the rules of engagement are quite
explicit. In any case, the current PEP has a % format specifier
operator, so you would need a way to have % inside your %%. There may
be some other issues with having the "transition to markup" and
"transition back to text" characters be the same, but I can't think of
them at the moment.
> [snip]
> > Feature: Automatic search of locals() and globals() for name lookups
> > if no parameters are given.
>
> -1
>
> for the obvious 'Explicit is better than implicit'.
Out of curiosity, do you feel that eval()'s use of this is somehow
different? I haven't been able to figure out a real difference yet.
> > (Description of comments deleted)
>
> -1
>
> The user can use the parser/compiler to get this behavior for free.
>
> (" text " #your comment here
> "more text").format(...)
I think breaking up strings this way can be really ugly. (I might be
alone here, but OTOH if I am, I'm not sure why triple-quoted strings
were invented :) I also think there may be use cases which involve,
e.g. strings read in from a separate text file. It might be handy to
have comments in that other file, and it would be nice not to require
a separate user-code parser to strip them out.
Thanks for the feedback. For some reason, my post hasn't garnered
that much attention yet. Do I need to post it on python-dev or
c.l.p., or are people just really busy with other things, or have I
breached some etiquette I don't yet understand?
Thanks,
Pat
More information about the Python-3000
mailing list