pylint woes

Steven D'Aprano steve at pearwood.info
Sun May 8 23:46:25 EDT 2016


On Mon, 9 May 2016 07:24 am, DFS wrote:

> On 5/8/2016 7:36 AM, Steven D'Aprano wrote:
>> On Sun, 8 May 2016 11:16 am, DFS wrote:
>>
>>> address data is scraped from a website:
>>>
>>> names = tree.xpath()
>>> addr  = tree.xpath()
>>
>> Why are you scraping the data twice?
> 
> 
> Because it exists in 2 different sections of the document.
> 
> names     = tree.xpath('//span[@class="header_text3"]/text()')
> addresses = tree.xpath('//span[@class="text3"]/text()')

How was I supposed to know that you were providing two different arguments
to the method? It looked like a pure-function call, which should always
return the same thing. Communication errors are on the sender, not the
receiver.

You didn't say what tree was, so I judged that xpath was some argument-less
method of tree that returned some attribute, sufficiently cleaned up.

It would be more obvious to pass a placeholder argument:

names = tree.xpath(this)
addr  = tree.xpath(that)



>>> I want to store the data atomically,
>>
>> I'm not really sure what you mean by "atomically" here. I know what *I*
>> mean by "atomically", which is to describe an operation which either
>> succeeds entirely or fails.
> 
> That's atomicity.

Right. And that doesn't apply to the portion of your code we're discussing.
There's no storage involved. The list comps do either succeed entirely or
fail, until you actually get to writing to the database, there's nothing
that "store the data atomically" would apply to that I saw.


[...]
>>> so I parse street, city, state, and
>>> zip into their own lists.
>>
>> None of which is atomic.
> 
> All of which are atomic.

Sorry, my poor choice of words. None of which are atomic *storage*.



>> Oh, and use better names. "street" is a single street, not a list of
>> streets, note plural.
> 
> I'll use whatever names I like.

*shrug*

Its your code, you can name all your variables after "Mr. Meeseeks" if you
want.

for meeseeks, Meeseeks, meeSeeks, MEEseeks in zip(
        MESEEKS, meeeseeks, MeesEeks, MEEsEEkS):
    mEEsEeKSS.append(meeSeeks)
    ...


Just don't ask others to read it.



-- 
Steven




More information about the Python-list mailing list