> Here filter is a variable locally scoped to the block defined by A, in that
> sense this is not different from:
>
> No, it’s not a locally scoped variable (binding in Python).
> It’s a class attribute.
How can it be an attribute of a class that doesn't exist yet? You must
differentiate a class being created from a class already created:
class A:
x = 1 # x is a local, A doesn't even exist at this point.
print(locals())
print(getattr(A, 'x')) # x is an attribute.
==>
{'__module__': '__main__', '__qualname__': 'A', 'x': 1}
1
Despite semantic subtleties, the point is that unqualified names are susceptible
of name clashes with builtins, while qualified named aren't.
> I understand fully what you ask for. It’s still inconsistent for the case of
> class attributes.
Again: differentiate between the class local scope at the point of
definition and proper class attributes. Then the rule is consistent.
> I just wonder if there is really a value to complicate the highlighting code
Well, it's a oneliner, but then I wouldn't mind putting it inside my
.vimrc, laissez-faire, laissez-passer ;).
> for a small use case like this compared to the value this “warning” gives.
Warnings are good when you can selectively disable false positives.
Otherwise they become distractions and you tend to overlook the real
ones. What I'm suggesting disables just a subset of false positives
(another subset is left hand sides). I don't see how it could hurt in
this sense.
> You do realize that this highlighting always existed and never bothered
> anybody until now. What if this gets changed and then users start
> complaining about the fact it’s not highlighted any more.
I suggested to keep the current behavior as default and adding one or
two lines of code to offer a new mode, without additional config
variables and retaining backward compatibility (just set
0=never,1=always and 2=non-qualified). Again, I wouldn't mind putting
that in my personal configuration. I just posted a patch that may be
useful for someone else, feel free to include it in the distributed
module (I can update it to add the 2=non-qualified mode, though).
> I’m taking a break this weekend.
Enjoy it.
Cheers
--
Carlos
--
--
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.