<div dir="ltr"><div>Ah, always mess up micro = 6/9 until I think about it for half a second. Maybe a "n" suffix could have saved me there ;) For "long" numbers there's the new _ so you can say 0.000_000_1 if you so preferred for 0.1 micro (I generally see _ as more useful for high-precison numbers with more non-zero digits, e.g. 1_234_456_789). Would that be 0.1µ, 0.1u in a new system.</div><div><br></div><div>Veering a bit away from the 'suffixing SI prefixes for literals': Literal unary suffix operators might be slightly nicer than multiplication if they were #1 in operator precedence, then you could omit some parentheses. Right now if I want to use a unit:<br></div><div><br></div><div>$ pip install quantities</div><div><div>import quantities as pq</div><div>F = 1 * pq.N</div><div>d = 1 * pq.m</div></div><div>F * d # => array(1.0) * m*N</div><div><br></div><div>but with literal operators & functions could be something like </div><div><br></div><div>F = 1 pq.N<br></div><div>d = 1 pq.m</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Oct 29, 2016 at 1:18 PM, Todd <span dir="ltr"><<a href="mailto:toddrjen@gmail.com" target="_blank">toddrjen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Sat, Oct 29, 2016 at 12:43 PM, Nick Timkovich <span dir="ltr"><<a href="mailto:prometheus235@gmail.com" target="_blank">prometheus235@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">From that page: <div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">User-defined literals are basically normal function calls with a fancy syntax. [...] While user defined literals look very neat, they are not much more than syntactic sugar. There is not much difference between defining and calling a literal operator with "foo"_bar and doing the same with an ordinary function as bar("foo"). In theory, we could write literal operators that have side effects and do anything we want, like a normal function.</blockquote><div><br></div><div>Obviously the arbitrary-function-part of that will never happen in Python (yes?)</div><div><br></div><br></div></div></blockquote><div><br></div></span><div>Why not? It seems like that would solve a lot of use-cases. People get bringing up various new uses for prefix or suffix syntax that they want built directly into the language. Providing a generic way to implement third-party prefixes or suffixes would save having to put all of these directly into the language. And it opens up a lot of other potential use-cases as well.<br></div></div></div></div>
<br>______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br></blockquote></div><br></div>