A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-September/028945.html below:

User extendable literal modifiers ?!

[Python-Dev] Re: User extendable literal modifiers ?!Gerhard Häring gerhard.haering@opus-gmbh.net
Fri, 27 Sep 2002 10:33:11 +0000 (UTC)
In article <3D9423FB.9070303@lemburg.com>, M.-A. Lemburg wrote:
> [mxNumber]
> I was wondering whether it would be worth adding something
> like a registry of literal modifiers to Python,

Especially for this purpose, that would be great. And have potential for
misuse, too. Just like, say, operator overloading. But in the context of
Python, I didn't see any misuse of operator overloading, yet.

> [...] so that
> extensions can register new modifiers with the compiler,
> e.g.
> 
> sitecustomize.py:
> def create_I_literal(literal_string):
>      return 'mx.Number.Integer(%s)' % literal_string
> sys.register_numberlitmod('I', create_I_literal)

A single literal, however, doesn't (easily) allow you to give precision and
scale arguments to your decimal literal. That's of course easy if you can
declare your variable, which you can't in Python. So we're back to
constructors/factory functions here, right?

-- Gerhard





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