Post AYxetnMVM9P3DyEU2S by ambv@mastodon.social
(DIR) More posts by ambv@mastodon.social
(DIR) Post #AYxeYHbGFeZEdQsQpk by ambv@mastodon.social
2023-08-21T16:35:47Z
0 likes, 0 repeats
Pro-tip if you're using #VSCode and #Python: use snippets to speed up things that you often want but “it's too much typing”.It feels great to type >>>[TAB] and get the full invocation for the interactive console in that line of code.
(DIR) Post #AYxeYIUCxMWHNqaJTk by jbowen@mast.hpc.social
2023-08-21T16:36:32Z
0 likes, 0 repeats
@ambv There's a new style "ifmain?"
(DIR) Post #AYxetnMVM9P3DyEU2S by ambv@mastodon.social
2023-08-21T16:40:26Z
0 likes, 0 repeats
@jbowen Ha, good eye! The newer thing would be to have a __main__.py in your package but my favorite thing is to use pyproject.toml and expose functions via [project.scripts] which gives them nice short names.`python3 -m something.something` sure is unambiguous but I really prefer short tool names. `black` instead of `python3 -m black`. This sort of thing.
(DIR) Post #AYxfDZDLfOXx8bNTyi by jbowen@mast.hpc.social
2023-08-21T16:43:59Z
0 likes, 0 repeats
@ambv Ah, got it.I spend most of my time at $DAYJOB writing single file scripts that stick to the standard library (though I am aware of PEP 723) and was wondering if there was a new preferred idiom for "ifmain."