pylint -- should I just ignore it sometimes?
Jean-Michel Pichavant
jeanmichel at sequans.com
Fri Oct 22 09:12:20 EDT 2010
Seebs wrote:
> On 2010-10-21, Jean-Michel Pichavant <jeanmichel at sequans.com> wrote:
>
>> Let me quote the paper I linked in the previous post:
>>
>> list1 = []
>> for x in theList:
>> if x[0] == 4:
>> list1 += x;
>> return list1
>>
>> compare it to:
>>
>> flaggedCells = []
>> for cell in theBoard:
>> if cell[STATUS_VALUE] == FLAGGED:
>> flaggedCells += cell
>> return flaggedCells
>>
>
> The latter is better, but:
>
> flagged = []
> for cell in board:
> if cell.flagged():
> flagged += cell;
>
> is probably even better.
>
[snip]
> -s
>
Right, may be there is an even better solution. This is not the point.
The point of this example is to show the power of meaningful names in a
very basic example. You said it yourself, the latter is better.
JM
More information about the Python-list
mailing list