New Python 3.0 string formatting - really necessary?

r rt8396 at gmail.com
Sat Dec 20 20:54:09 EST 2008


On Dec 20, 7:38 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Sat, 20 Dec 2008 16:20:38 -0800, r wrote:
> > On Dec 20, 6:05 pm, Roy Smith <r... at panix.com> wrote:
> >> I had an interesting experience with this recently.  I was giving a
> >> co-worker quick python into.  He's an experienced programer in various
> >> languages, but this was his first exposure to python.
>
> >> He got really hung up on the % syntax.  By (bad) luck, he was trying to
> >> print a tuple (let's call it "t"), did
>
> >> format % t
>
> >> and was surprised at the result.  It set him off on a "but that's
> >> stupid, blah, blah, blah" rant.  I haven't absorbed the new syntax well
> >> enough to figure out if people will get hung up by this with the new
> >> syntax.
>
> > It is stupid, more reason to fix the current problem instead creating a
> > whole new one.
>
> Instead of just whinging, how about making a suggestion to fix it? Go on,
> sit down for an hour or ten and try to work out how a BINARY OPERATOR
> like % (that means it can only take TWO arguments) can deal with an
> arbitrary number of arguments, *without* having any special cases.
>
> Go on. Take your time. I'll be waiting.
>
> > One more big complaint "THE BACKSLASH PLAGUE". ever tried regexp?, or
> > file paths?. All because that little backslash char is a line
> > continuation character, maybe we should fix that.
>
> This makes no sense whatsoever. How does the line continuation character
> make any difference to backslashes inside a regex or a file path?
>
> Again, instead of whinging, what's your suggestion to fix it? Another
> suggestion, because your first:
>
> > Would your life end if '\' was not a continuation char?
>
> is just stupid. The line continuation character is *irrelevant* to the
> problem of backslashes inside strings. For all the use it is, you might
> as well suggest changing the name None to Null.
>
> --
> Steven

i prefer None over Null myself, just another Pythonic beauty! ;)

Steven,
Would you like to elaborate on -why- escaped backslashes are needed in
strings... i waiting???



More information about the Python-list mailing list