From: Nelle V. <nel...@gm...> - 2014-03-06 21:13:19
|
On 6 March 2014 22:03, 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. The opposite also holds: personally, my brain shuts down when I see an underscore, because I know those values aro no use in this context. If there are variables names that aren't use, it confuses me, and I try to understand where they are use. If I need to understand what exactly os.stat returns, I just read the documentation, and not rely on some possibly misleading variable names. We can debate hours whether these conventions are justified or not. It all comes down to what's your habit. >From the google style guide (pylint section): Unused argument warnings can be suppressed by using `_' as the identifier for the unused argument or prefixing the argument name with `unused_'. In situations where changing the argument names is infeasible, you can mention them at the beginning of the function. For example: def foo(a, unused_b, unused_c, d=None, e=None): _ = d, e return a > > Skip |