[wingide-users] Released 2 new scripts: `flip` and `deep-to-var`

Ram Rachum ram at rachum.com
Sat Feb 25 06:11:38 MST 2012


Hello,

I released 2 new scripts for Wing IDE, `flip` and `deep-to-var`:

http://wiki.wingware.com/Flip
http://wiki.wingware.com/DeepToVar

`flip` is a simple one: It flips between `True` and `False`.

`deep-to-var` is more complex. Here is its description:

Create a variable from a deep expression.

When you're programming, you're often writing lines like these:

    html_color = self._style_handler.html_color

Or:

    location = context_data['location']

Or:

    event_handler = super(Foobsnicator, self).get_event_handler()

What's common to all these lines is that you're accessing some expression,
sometimes a deep one, and then getting an object, and making a variable for
that object with the same name that it has in the deep expression.

What this `deep-to-var` script will do for you is save you from having to
write
the `html_color = ` part, which is annoying to type because you don't have
autocompletion for it.

Just write your deep expression, like `self._style_handler.html_color`,
invoke
this `deep-to-var` script, and you'll get the full line and have the caret
put
on the next line.

Suggested key combination: `Alt-Insert E`




Enjoy!


Ram.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/wingide-users/attachments/20120225/19a17bc6/attachment.html>


More information about the wingide-users mailing list