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