Bitten by my C/Java experience

Dave Angel davea at davea.name
Mon May 4 19:17:26 EDT 2015


On 05/04/2015 04:28 PM, Cecil Westerhof wrote:
> Op Monday 4 May 2015 21:39 CEST schreef Ian Kelly:
>
>> On Mon, May 4, 2015 at 11:59 AM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
>>> On 04/05/2015 16:20, Cecil Westerhof wrote:
>>>>
>>>> Potential dangerous bug introduced by programming in Python as if
>>>> it was C/Java. :-( I used: ++tries that has to be: tries += 1
>>>>
>>>> Are there other things I have to be careful on? That does not work
>>>> as in C/Java, but is correct syntax.
>>>>
>>>
>>> Not dangerous at all, your test code picks it up. I'd also guess,
>>> but don't actually know, that one of the various linter tools could
>>> be configured to find this problem.
>>
>> pylint reports it as an error.
>
> I installed it. Get a lot of messages. Mostly convention. For example:
>      Unnecessary parens after 'print' keyword

Sounds like it's configured for Python 2.x.  There's probably a setting 
to tell it to use Python3 rules.

>
> And:
>      Invalid variable name "f"
> for:
>      with open(real_file, 'r') as f:

Sounds like a bad wording.  Nothing invalid about it, though it is a bit 
short.  There are certain one letter variables which are so common as to 
be expected, but others should be avoided.


>
> But still something to add to my toolbox.
>


-- 
DaveA



More information about the Python-list mailing list