A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-January/019483.html below:

Suggested changes to PEP 215

[Python-Dev] Re: Suggested changes to PEP 215Ka-Ping Yee ping@lfw.org
Mon, 14 Jan 2002 21:30:47 -0600 (CST)
On Mon, 14 Jan 2002, Ka-Ping Yee wrote:
> 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 have just realized, upon careful thought, that it would be better
to make this syntactic transformation the official specification of
the feature, rather than simply an implementation suggestion.

The current specification is incomplete because it does not adequately
handle certain corner cases:

                             (current PEP)
                             \ then $        $ then \    what i want

    >>> x = 'x41'
    >>> print $'\$x'
    ???                      \x41            A           \x41

    >>> print $'\x24x'
    ???                      x41             $x          $x

    >>> y = '41'
    >>> print $'\x$y'        ???             A           SyntaxError
    ???

The issue is whether backslash-interpretation happens first, or
dollar-interpretation happens first.  The current PEP says \ first.

I hope you see why i want the first case *not* to do \x interpretation
and why i want the second case not to do $ interpretation.  (The
programmer shouldn't have to look for \x24 in her code!)  The third
case is a mess and should definitely be a syntax error.

I'll write a new PEP.


-- ?!ng




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4