[wingide-users] Syntax highlighting for builtins?

Mike Driscoll mdriscoll at co.marshall.ia.us
Mon Jul 14 11:25:55 MDT 2008


Michael Foord wrote:
> <div class="moz-text-flowed" style="font-family: -moz-fixed">Wingware 
> Support wrote:
>> Mike Driscoll wrote:
>>> Are there any plans to add support for builtins then? Or is there a 
>>> plug-in that does this that some clever individual has created? I've 
>>> noticed this with other Python IDE's too and wondered why IDLE seems 
>>> to be the only popular one that includes builtin hightlighting. I 
>>> can't be the only one who cares about accidentally shadowing a builtin.
>>
>> It's not been requested before, as far as I know, so isn't in our 
>> plans yet.
>>
>> If you do shadow a builtin, it really doesn't matter unless you need 
>> to use the
>> builtin in the same scope.  In that case it's probably fairly obvious 
>> what's
>> going on.  For example, you could goto-definition on the name and 
>> Wing would
>> go to your shadow's point of definition.
>
> It isn't always obvious and it is an issue I have seen others encounter.
>
> Consider the following code inside the body of a method.
>
> for i in range(x):
>    do_something()
>
> .... more code
>
> range = GetRange()
>
> When executed, the *first* use of range blows up with an
> 'UnboundLocalError', since range is now an unbound local variable rather
> than a builtin. As the exception doesn't occur at the point of the
> problem it can be confusing if you don't know what is going on.
>
> FWIW, detecting builtin shadowing is one of the things we use PyLint for.
>
> Michael Foord
>
>

Thanks for that. This is similar to what I've seen on c.l.py from time 
to time, which is why I was hoping that Wingware had builtins 
highlighted too. I showed the Wingware IDE to my boss and he thinks it 
looks good too, but has reservations about buying it for himself because 
of the lack of builtin highlighting.

Mike




More information about the wingide-users mailing list