A Bug By Any Other Name ...

Chris Rebert clp2 at rebertia.com
Tue Jul 7 07:18:20 CEST 2009

On Mon, Jul 6, 2009 at 10:13 PM, Steven
D'Aprano<steve at remove-this-cybersource.com.au> wrote:
> 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)

Well, yes, but when would you apply it twice in a row?

(Not that I strongly support the prohibition idea, just thought it
should be brought up)


More information about the Python-list mailing list