pylint woes
DFS
nospam at dfs.com
Sun May 8 10:26:26 EDT 2016
On 5/7/2016 11:46 PM, Stephen Hansen wrote:
> On Sat, May 7, 2016, at 08:04 PM, DFS wrote:
>> The lists I actually use are:
>>
>> for j in range(len(nms)):
>> cSQL = "INSERT INTO ADDRESSES VALUES (?,?,?,?,?)"
>> vals = nms[j],street[j],city[j],state[j],zipcd[j]
>>
>>
>> The enumerated version would be:
>>
>> ziplists = zip(nms,street,city,state,zipcd)
>> for nm,street,city,state,zipcd in ziplists:
>> cSQL = "INSERT INTO ADDRESSES VALUES (?,?,?,?,?)"
>> vals = nm,street,city,state,zipcd
>>
>>
>> I guess the enumeration() is a little nicer to look at. Why do you
>> think it's more maintainable?
>
> Code is read more then its written.
>
> That which is nicer to look at, therefore, is easier to read.
>
> That which is easier to read is easier to maintain.
>
> Beyond that, its simpler, and more clearly articulates in the local
> space what's going on.
That last one sounds like an art critic trying to exlain why Jackson
Pollock's work doesn't suck.
>> Aside: I haven't tried, but is 'names' a bad idea or illegal for the
>> name of a python list or variable?
>
> Nothing wrong with names. Or 'name', for that matter. Try to avoid
> abbreviations.
np
More information about the Python-list
mailing list