[wingide-users] if __name__ == "main"
mlm at acm.org
Sat Oct 19 16:19:37 MDT 2013
On Oct 19, 2013, at 2:00 PM, Mike Driscoll <mike at pythonlibrary.org> wrote:
> This is probably me just being lazy, but Wing's autocomplete is so handy
> that I always miss it when it won't autocomplete __name__ when I am typing
> the following typical construct:
> if __name__ == "__main__"
> I notice Wing will happily recognize __name__ after I have typed it out as
> it changes color. And Wing will autocomplete double-underscore items from
> classes, so I don't really know why it's autocomplete doesn't work in this
> Is there a way to enable it? Or perhaps create one of those cool
> autocomplete snippets for it?
Snippets can autocomplete: In Wing 5 (similarly, but maybe not exactly, in Wing 4 too) turn on "Include Snippets in Completer" in the Preferences under Editor>Auto-Completion>Completion Mode.
Then, just define the snippet with the name and content you want. I call mine "ifm" and define it as:
if __name__ == '__main__':
Type ifm, an autocomplete key (tab, in particular) and start typing.
More information about the wingide-users