<div dir="ltr">On Mon, Mar 10, 2014 at 12:12 PM, Oscar Benjamin <span dir="ltr"><<a href="mailto:oscar.j.benjamin@gmail.com" target="_blank">oscar.j.benjamin@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">On 10 March 2014 10:59, Steven D'Aprano <<a href="mailto:steve@pearwood.info">steve@pearwood.info</a>> wrote:<br>
> On Mon, Mar 10, 2014 at 10:07:11AM +0000, Oscar Benjamin wrote:<br>
>> On 9 March 2014 20:39, Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br>
>> > On Sun, Mar 9, 2014 at 1:07 PM, Oscar Benjamin <<a href="mailto:oscar.j.benjamin@gmail.com">oscar.j.benjamin@gmail.com</a>> wrote:<br>
>> >><br>
>> >> The problem though is with things like +3.14d or -3.14d. Python the<br>
>> >> language treats the + and - signs as not being part of the literal but<br>
>> >> as separate unary operators.<br>
><br>
> Is that still true? Possibly the peephole optimizer has changed the<br>
> situation?<br>
<br>
</div>Yes it does. It also does the same for "complex literals" even though<br>
the language formally only defines imaginary literals.</blockquote><div><br></div><div>... and don't forget the Python 2.x-only hack for negation of integers:</div><div><br></div><div><p style="margin:0px;font-size:12px;font-family:Monaco">
>>> type(-9223372036854775808)</p>
<p style="margin:0px;font-size:12px;font-family:Monaco"><type 'int'></p>
<p style="margin:0px;font-size:12px;font-family:Monaco">>>> type(-(9223372036854775808))</p>
<p style="margin:0px;font-size:12px;font-family:Monaco"><type 'long'></p></div><div><br></div><div>which means that it's not true that Python 2.x behaves "as if" there were no negative literals. Python 3 is cleaner in this respect. I guess this shows that we *could* in theory reintroduce such a hack for negation of decimal literals, but I agree with everyone else so far that that would be a bad idea.</div>
<div><br></div><div>-- </div><div>Mark</div></div></div></div>