pylint -- should I just ignore it sometimes?

Seebs usenet-nospam at seebs.net
Tue Oct 19 19:30:59 EDT 2010


On 2010-10-19, Martin P. Hellwig <martin.hellwig at dcuktec.org> wrote:
> Speaking without context here, so take it with as much salt as required 
> ;-), it is not that unusual. However there are some things to consider, 
> for example are all these attributes related to each other? If so 
> wouldn't it be more pythonic to have one attribute which is a dictionary 
> and store your stuff in there?

I don't know.  Does "pythonic" mean "needlessly verbose"?  :)

I did, in an early draft, have something that basically came down to:

	self.foo = {}
	self.foo['a'] = a()
	self.foo['b'] = b()

and then I realized that I could just write:
	self.a = a()
	self.b = b()

and spend a lot less extra typing on repeating something that, by virtue
of being repeated constantly, was therefore meaningless.  It wasn't creating
a meaningful distinction, it wasn't showing a meaningful relationship...
All these things are attributes of the thing itself, not attributes of its
dictionary.

> As everything pylint is a really useful tool especially when you just 
> start writing in python and it can give you valuable clues on how to 
> improve your programming. So just take it as hints that there might be 
> ways to write it better, have a think about it, perhaps ask as you have 
> done, and happily ignore it if all else fails :-)

Part of the trick is I'm trying to figure out when the problem is that my
intuition about what makes code "readable" contradicts the norms of the python
community, and when the problem is just that pylint is being dogmatic where
real programmers would likely exercise judgement.

-s
-- 
Copyright 2010, all wrongs reversed.  Peter Seebach / usenet-nospam at seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.



More information about the Python-list mailing list