[Python-ideas] Settable defaulting to decimal instead of float

Stephan Houben stephanh42 at gmail.com
Thu Jan 12 07:13:50 EST 2017


Something like:

from __syntax__ import decimal_literal

which would feed the rest of the file through the "decimal_literal"
transpiler.
(and not influence anything in other files).

Not sure if you would want to support multiple transpilers per file.

Note that Racket has something similar with their initial "#lang ..."
directive.
That only allows a single "language". Possibly wisely so.

Stephan


2017-01-12 12:59 GMT+01:00 אלעזר <elazarg at gmail.com>:

> I think such proposals are special cases of a general theme: a compiler
> pragma, similar to "from __future__", to make Python support
> domain-specific syntax in the current file. Whether it's decimal literals
> or matrix/vector literals etc.
>
> I think it will be nice to make some tool, external to Python, that will
> allow defining such "sibling languages" (transpiled into Python) easily and
> uniformly.
>
> Elazar
>
> בתאריך יום ה׳, 12 בינו' 2017, 13:21, מאת Paul Moore ‏<p.f.moore at gmail.com
> >:
>
>> On 12 January 2017 at 10:28, Victor Stinner <victor.stinner at gmail.com>
>> wrote:
>> > George requested this feature on the bug tracker:
>> > http://bugs.python.org/issue29223
>> >
>> > George was asked to start a discusson on this list. I posted the
>> > following comment before closing the issue:
>> >
>> > You are not the first one to propose the idea.
>>
>> OK, but without additional detail (for example, how would the proposed
>> flag work, if the main module imports module A, then would float
>> literals in A be decimal or binary? Both could be what the user wants)
>> it's hard to comment. And as you say, most of this has been discussed
>> before, so I'd like to see references back to the previous discussions
>> in any proposal, with explanations of how the new proposal addresses
>> the objections raised previously.
>>
>> Paul
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170112/3d21d0d3/attachment.html>


More information about the Python-ideas mailing list