[Python-Dev] more pychecker warnings from python-current
Tim Peters
tim.one@home.com
Wed, 17 Oct 2001 22:30:54 -0400
>> doctest.py:528: Parameter (prefix) not used
>> docstring says prefix is used, but it isn't
> Tim?
No, the docstring says prefix is ignored:
def is_private(prefix, base):
"""prefix, base -> true iff name prefix + "." + base is "private".
Prefix may be an empty string, and base does not contain a period.
Prefix is ignored (although functions you write conforming to this
^^^^^^^^^^^^^^^^^
protocol may make use of it).
...
is_private is a user-replaceable function, and doctest is careful to *pass*
the correct prefix to it, but the default implementation makes no use of
prefix. It's there for advanced users who want to factor in, e.g., the name
of a containing class, when making an "is this name private?" decision.
I wouldn't be averse to adding, e.g.,
if 0:
prefix # make prefix appear used to checking tools
but sooner or later checking tools will complain about that too.
In my last job, we resorted to a C++ macro of the flavor
#define UNUSED_VAR_OK(VAR) (void)ignore_var((void*)&(VAR))
to shut up compiler wngs about intentionally ignored vrbls, and actually had
a do-nothing extern void ignore_var(void*) function -- nothing short of that
shut up every compiler we used.
can't-win-ly y'rs - tim