A Bug By Any Other Name ...

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Tue Jul 7 07:13:30 CEST 2009


On Tue, 07 Jul 2009 04:51:51 +0000, Lie Ryan wrote:

> Chris Rebert wrote:
>> On Mon, Jul 6, 2009 at 1:29 AM, Lawrence
>> D'Oliveiro<ldo at geek-central.gen.new_zealand> wrote:
>>> In message <mailman.2674.1246866966.8015.python-list at python.org>, Tim
>>> Golden wrote:
>>>
>>>> The difficulty here is knowing where to put such a warning. You
>>>> obviously can't put it against the "++" operator as such because...
>>>> there isn't one.
>>> This bug is an epiphenomenon. :)
>> 
>> Well, like I suggested, it /could/ be made an operator (or rather, a
>> lexer token) which just causes a compile/parse error.
>> 
>> Cheers,
>> Chris
> 
> There are edge cases (level: very rare) where you legitimately want to
> actually do that, e.g.:

Not so rare. Decimal uses unary plus. Don't assume +x is a no-op.


Help on method __pos__ in module decimal:

__pos__(self, context=None) unbound decimal.Decimal method
    Returns a copy, unless it is a sNaN.

    Rounds the number (if more then precision digits)



-- 
Steven



More information about the Python-list mailing list