From: Joe K. <jki...@ge...> - 2014-03-06 21:24:41
|
On Thu, Mar 6, 2014 at 3:03 PM, Skip Montanaro <sk...@po...> wrote: > On Thu, Mar 6, 2014 at 2:51 PM, Nelle Varoquaux > <nel...@gm...> wrote: > > The convention is to use a simple _. > > > > mode, _, dev, nlink, uid, gid, size, _, _, _ = os.stat("/etc/hosts") > > Which is "pylint-compliant", but removes any description to future > readers (who might decide to use them) what the meaning of those > various unused values are. > Just to bikeshed a bit: There are common cases where a bare "_" really is a good solution. E.g. something = [object() for _ in range(10)] It's immediately clear a) what "_" is, and b) that it's unused. "for _i in range(10)" is more jarring in that particular case, i.m.h.o. I do agree that "_descriptive_name" is better in many situations. I'd just argue for a "prefer this, but use your best judgement" type guideline rather than a strict rule. Then again, I'm not actively involved in development, so I probably shouldn't hold too much of an opinion either way. Cheers, -Joe |