On Sun, Apr 03, 2022 at 01:09:00PM +0900, Stephen J. Turnbull wrote: > There was a proposal to provide literal syntax for physical units like > meters, kilograms, and seconds, along the the SI magnitude prefixes. > I think that got to the "proto-PEP" stage, but it got a lot of weak > opposition for a number of reasons, mostly "Python isn't intended for > creating DSLs
Python is excellent for creating DSLs. It is one of the things it is well known for. https://www.startpage.com/sp/search?query=writing+dsls+in+python > There are frequently proposals to give the Decimal constructor a > literal syntax, always rejected on the grounds that it's not needed > and there hasn't been a really compelling syntax that everybody likes. That's not my recollection. My recollection is that in principle, at least, there is a reasonable level of support for a built-in decimal type, no strong opposition, and consensus that the syntax that makes the most sense is a "d" suffix: 6.0123d The implementation would be a fixed-precision (64- or 128-bit) type rather than the variable precision implementation used in the decimal module, which would massively reduce the complexity of the implementation and the public interface. (No context manager for the builtin decimal, fixed precision, only one rounding mode, no user-control over what signals are trapped, etc. If you need all those bells and whistles, use the decimal module.) The discussion fizzled out rather than being rejected. Whether it would be rejected *now*, two or four(?) years later, by a different Steering Council, is another story. > There are also frequent proposals to create special string literals, > with occasionals successes like rawstrings (the r"" syntax) Raw strings were added in Python 1.5 to support the new re module: https://www.python.org/download/releases/1.5/whatsnew/ There was no formal mechanism for adding new features back then. -- Steve _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/PQ2NZOZ2RCM7GT4GNXLDP3KB5SHTTPXQ/ Code of Conduct: http://python.org/psf/codeofconduct/