On Sunday, April 9, 2017 at 11:26:47 AM UTC-5, Edward K. Ream wrote:

The following code will test this switch:
>
>     if getattr(self, 'allow_undefined_section_references'):
>

 Oops:  This should be:

    if getattr(self, 'allow_undefined_section_references', False):

or more simply:

    if hasattr(self, 'allow_undefined_section_references'):

The more I think about this pattern, the better I like it.  The hasattr 
test clearly indicates that the switch is inited in a non-standard way.  A 
search for the ivar name will show where.  Long ivar names are better, 
because safer (less likely to collide with an existing ivar).

This is so good. The "setter" code in leo.plugins.importers.javascript.py 
can "coordinate" with at.putRefLine without change *any* other code in the 
AtFile class. There can never be the slightest "huh?" about what is going 
on.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to