On Wed, 5 Apr 2006, Greg Ewing wrote:
[...]
> There are other problems with the $ syntax too.
> The lack of an explicit closing marker causes
> problems when the parameter is immediately
> followed in the string by an alphanumeric
> character. You end up having to allow some
> kind of bracketing as an optional extra
> anyway, such as
>
> subst("I'm a ${what}spotter", what = "train")
>
> Seems to me it's simpler as well as clearer
> to just make the syntax fully bracketed in the
> first place.
One argument against the plain {} syntax would be that, if you believe
there should be one syntax that handles both simple substitution and
formatting-with-format-characters nicely, you need somewhere to put the
format characters. Putting them at the end is problematic, as we know.
But how about putting them at the start, after the $? That way, the
format character can't get mixed up with the text following it. For
example, $r{foo} would mean the same as the current %(foo)r.
John
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com