Bitten by my C/Java experience

Mark Lawrence breamoreboy at yahoo.co.uk
Wed May 6 16:13:23 EDT 2015


On 06/05/2015 17:03, Steven D'Aprano wrote:
> On Wed, 6 May 2015 10:40 pm, BartC wrote:
>
>> But I had in mind not implementing ++ and --, but detecting them and
>> issuing a warning,
>
> That's a job for a linter, not the compiler. The compiler should be as
> flexible as possible in what it accepts:
>
>
> a   ,    b=12+3     *          4,"hello"          .      upper   ()
>
>
> is perfectly legal code. The compiler shouldn't force you to write good
> looking code, apart from what is prohibited altogether.
>
> Both + and - are unary prefix operators, so you can apply + and - to any
> expression -- even an expression that already has a unary prefix operator:
>
> py> -     --- +++ + - - + -- +++ --- 999
> -999
>
>
> Is that ugly, horrible code that nobody in their right mind would use in
> production? Absolutely. But the compiler can and should accept it, and
> linters (or human reviewers) should warn about it.
>

Linters were mentioned a day or two back.  Take a horse to water...

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list