[Python-ideas] User-defined literals

Paul Moore p.f.moore at gmail.com
Fri Jun 5 19:42:03 CEST 2015


On 5 June 2015 at 17:13, Andrew Barnert <abarnert at yahoo.com> wrote:
> Anyway, the important question for me is whether people want this for any other type than Decimal

Personally, I don'tuse decimals enough to care. But I like Nick's
generalised version, and I can easily imagine using that for a number
of things: unevaluated code objects or SQL snippets, for example. I'd
like to be able to use it as a regex literal, as well, but I don't
think it lends itself to that (I suspect a bare regex would choke the
Python lexer far too much).

But yes, the big question is whether it would be used sufficiently to
justify the work. And of course, it'd be Python 3.6+ only, so people
doing single-source code supporting older versions wouldn't be able to
use it for some time anyway. That's a high bar for *any* new syntax,
though, not specific to this.

Paul


More information about the Python-ideas mailing list