> On Jul 31, 2015, at 9:43 AM, Carlos Pita <[email protected]> wrote:
> 
> Hi all,
> 
> the syntax rules for python incorrectly consider, say, both `filter` and 
> `obj.filter` as instances of the builtin `filter`.

Yes, I’m aware of this. I don’t think it’s incorrect though.

>  I've added a rule to explicitly set the group of attributes (defined as an 
> identifier following a dot) to none. Maybe it's better to create a new group 
> for attributes, I'm not sure. I will update the patch with any improving 
> suggestion.

Maybe, this should be a warning sign that you are using the name that’s also a 
builtin which is at least a bad practice? :-)

For example, take this program:

class A:
    filter = None

def bogus_filter():
    pass

filter = bogus_filter
# lots of code in between
filter(...)  # oops, just called bogus_filter instead of the real one

a = A()
a.filter = 2

- your change will strip the highlighting only from the last line in “a.filter”.
- your change will not strip highlighting from the line in class A: “filter = 
None”

Questions for you:

- Is there any value in making an exception for only a.filter line?
- How about filter = None line?
- Do you consider useful a highlighting hint that you are using a builtin name 
as the name of the binding that’s assigned bogus_filter? Wouldn’t this prevent 
a mistake later?

I’m not convinced that such change adds enough value for a small number of 
cases, while it does take away the value of a warning that one is making a 
potential mistake. Isn’t that the main reason we use syntax highlighting?

What does the rest of Vim community think?

Regards,

        Zvezdan

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

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

Raspunde prin e-mail lui