On May 29, 6:22 am, "Edward K. Ream" <[email protected]> wrote:

> The "#pylint: disable=" construct applies to the smallest enclosing
> statements, so sometimes you will see the comment inside an "if 1:"
> statement.  For example::
>
>     if 1:
>         # pylint: disable=W0108
>         # W0108: LeoNode.<lambda>: Lambda may not be necessary
>         v = property(lambda self: eval_node(self), __set_val,
>             doc = "Node evaluated value")

Rev 5374 improves such tests significantly: pylint disable statements
now apply to the *smallest* possible range of statements.

Pylint disable comments can be associated with individual statements,
so the "if 1:" hack is never necessary.  The above can be rendered in
two ways::

    # W0108: LeoNode.<lambda>: Lambda may not be necessary
    v = property(lambda self: eval_node(self), __set_val, # pylint:
disable=W0108
        doc = "Node evaluated value")

or::

    v = property(
        # pylint: disable=W0108
        # W0108: LeoNode.<lambda>: Lambda may not be necessary
        lambda self: eval_node(self), __set_val,
        doc = "Node evaluated value")

Here, the difference is a matter of style, but there are many cases
where disabling pylint tests over the *smallest* range possible.
Often the disable range consists of a single statement.  For example,
the following now appears in init_ipython::

   IPython.Shell.hijack_tk() # pylint: disable=E1101
        # E1101: init_ipython: Module 'IPython' has no 'Shell' member

Previously, the E1101 message was disabled throughout the entire
function.  We never want to do that.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to