Friday finking: IDE 'macro expansions'

Weatherby,Gerard gweatherby at uchc.edu
Sat Mar 18 07:49:24 EDT 2023


I send ~99% of Python coding time in PyCharm. Likewise, IntelliJ and Clion for Java and C++, respectively.

Mostly use:
Tab completion for variable names
Letting PyCharm figure out imports for me, and cleaning up old, unused imports.
Jumping to definitions of symbols.
Tellling me I’ve made a type error before unit testing the code by highlighting it in yellow.
       Occasionally I’ll jump through the hoops to connect it to our Postgresql database to help verify SQL, but it’s not usually worth the trouble.

For templating, I have two Python programs for starting new work. One generates a standalone Python program with the Python shebang, a __main__ which calls def main(), and logging and argparser intialization. The other generates a pyproject.toml  /setup.cfg directory structure with a main.py referenced as a console script. from setup.cfg


From: Python-list <python-list-bounces+gweatherby=uchc.edu at python.org> on behalf of dn via Python-list <python-list at python.org>
Date: Thursday, March 16, 2023 at 6:59 PM
To: 'Python' <python-list at python.org>
Subject: Friday finking: IDE 'macro expansions'
*** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

It is a long, long, time since I've thrown one of these into the
maelstrom of our musings.
(have the nightmares receded?)


Do you make use of your IDE's expansionist tendencies, and if-so, which
ones?


NB this is where vi/emacs enthusiasts start chuckling (polite term for
'insane cackling'). Hence the question's limitation to IDEs, cf 'editors'!
Also: I'm talking 'PyCharm' because of the story, but others use Codium,
Sublime Text, etc - which presumably offer equivalent features.


Was helping a friend install PyCharm. Jumped into the Settings. Isn't it
incredible how many there are?

Idly noted that there are two short-cut or macro-expansion types of
facilities:
- Postfix Completion, (nothing to do with email or polish notation) and
- Live Templates (again, we're not talking about jinja2)


With both, one types an abbreviated-name and the IDE will expand it into
appropriate code. For (LiveTemplate) example, typing compli and pressing
Tab induces PyCharm to add the following to the program[me]:

     [ ! for ! in !drop-down menu! if ! ]

It offers further typo-saving through the drop-down menu which lists a
bunch of likely (iterable) candidates from amongst previously-written
code. The action continues after selecting from the menu, by inviting
completion of the other ("!") placeholders, in-turn.


I haven't made use of such a tool, to-date - OK, yes, I have practised a
high typing-speed (and accuracy). Puff, puff...

Also, at the time, I'm thinking in 'code', rather than about what tool
might implement said ideas.


Do you make use of such expansionist-tendencies?

Do you make use of other powerful features within the IDE, or are its
editor functionalities employed at pretty-much the NotePad level?



Web.Refs:
https://urldefense.com/v3/__https://www.jetbrains.com/help/pycharm/settings-postfix-completion.html__;!!Cn_UX_p3!l5XlkM7xExYMxpwFOxIvLPLSWPm_iu_aRv0WpnvCW2353FzsFjuJKfOYr-rCsnE915Rk59u6F4CgKPuF7fWLqicNTA$<https://urldefense.com/v3/__https:/www.jetbrains.com/help/pycharm/settings-postfix-completion.html__;!!Cn_UX_p3!l5XlkM7xExYMxpwFOxIvLPLSWPm_iu_aRv0WpnvCW2353FzsFjuJKfOYr-rCsnE915Rk59u6F4CgKPuF7fWLqicNTA$>
https://urldefense.com/v3/__https://www.jetbrains.com/help/pycharm/using-live-templates.html*live_templates_types__;Iw!!Cn_UX_p3!l5XlkM7xExYMxpwFOxIvLPLSWPm_iu_aRv0WpnvCW2353FzsFjuJKfOYr-rCsnE915Rk59u6F4CgKPuF7fUOn2vrzA$<https://urldefense.com/v3/__https:/www.jetbrains.com/help/pycharm/using-live-templates.html*live_templates_types__;Iw!!Cn_UX_p3!l5XlkM7xExYMxpwFOxIvLPLSWPm_iu_aRv0WpnvCW2353FzsFjuJKfOYr-rCsnE915Rk59u6F4CgKPuF7fUOn2vrzA$>
--
Regards,
=dn
--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!l5XlkM7xExYMxpwFOxIvLPLSWPm_iu_aRv0WpnvCW2353FzsFjuJKfOYr-rCsnE915Rk59u6F4CgKPuF7fUQeq7a_w$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!l5XlkM7xExYMxpwFOxIvLPLSWPm_iu_aRv0WpnvCW2353FzsFjuJKfOYr-rCsnE915Rk59u6F4CgKPuF7fUQeq7a_w$>


More information about the Python-list mailing list