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-September/028949.html below:

User extendable literal modifiers ?!

[Python-Dev] Re: User extendable literal modifiers ?!Samuele Pedroni pedronis@bluewin.ch
Fri, 27 Sep 2002 14:29:49 +0200
From: Alex Martelli <aleax@aleax.it>
> I thought this use would have to return the sequence of
> tokens for identifier 'Rational', open parenthesis, literal
> (value of) numerator, comma, literal (value of) denominator,
> closed parenthesis -- which in turn is why I thought of an
> arbitrary sequence of tokens.  If a single instance of any
> arbitrary class may be returned and get treated as a
> literal token by the parser, then that's much better

indeed, because then otherwise

$r"123/234" = literal transformation => Rational(123,234)

would require Rational to be installed in the builtins, or some kind of
implicit import (ugly) or people would have to rember to put an explicit from
... import Rational in all modules that use $r, one import per program just to
register $r would not be enough.

regards




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