• Suggestion: Regex string specifier like r and f

    From Raphael Santiago@21:1/5 to All on Sun Jan 8 12:44:30 2023
    Maybe something like re""
    It should behave exactly like a raw string but would be useful for syntax highlighting and debugging. Perhaps also for type hinting expected regex
    input (don't know if this is feasible).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Barry@21:1/5 to All on Sun Jan 8 21:50:08 2023
    On 8 Jan 2023, at 21:16, Raphael Santiago <raphael.santiago.53@gmail.com> wrote:

    Maybe something like re""
    It should behave exactly like a raw string but would be useful for syntax highlighting and debugging. Perhaps also for type hinting expected regex input (don't know if this is feasible).

    This is unlikely to be implemented. See https://discuss.python.org/t/allow-for-arbitrary-string-prefix-of-strings/19740/12 for related idea discussion.

    Barry


    --
    https://mail.python.org/mailman/listinfo/python-list


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Cameron Simpson@21:1/5 to Raphael Santiago on Mon Jan 9 08:47:56 2023
    On 08Jan2023 12:44, Raphael Santiago <raphael.santiago.53@gmail.com> wrote: >Maybe something like re""
    It should behave exactly like a raw string but would be useful for syntax >highlighting and debugging. Perhaps also for type hinting expected regex >input (don't know if this is feasible).

    A nice idea. (Though I'm personally reluctant to make regexps any
    "easier" to use than they are already, a discussion for another thread.)

    But the IDE/syntax help is cool.

    There was discussion of essentially this idea just recently here: https://discuss.python.org/t/allow-for-arbitrary-string-prefix-of-strings/19740 which you will find interesting.

    I think it fizzled for 2 main reasons:
    - string prefixes current have semantic meaning for the Python
    parser/interpreter, while an artbitrary prefix ... doesn't
    - "too hard"? to get IDEs to use it?

    Of these, I only find the former compelling, and one could argue that
    type annotations already form a "has no effect" syntax extension to
    Python, so we're already in that playground :-)

    Cheers,
    Cameron Simpson <cs@cskk.id.au>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)