Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Clean up snippets in the python module #3

Open
wants to merge 7 commits into
base: default
Choose a base branch
from

Conversation

paaguti
Copy link

@paaguti paaguti commented May 17, 2022

HI,

I put all snippets as single strings with \n and \t to make better tabulations...

init.lua Outdated
"\t)\n"
snip.ifmain = "if __name__ == '__main__':\n" ..
"\t%1(main())\n"
snip.class = "class %1(ClassName)%0:\n\t'''%2(documentation)'''\n\n" ..
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would much rather prefer something like this:

snip.class = table.concat({
  "class %1(ClassName)%2((%3(object))):",
  "\t%4('''%5(documentation)'''",
  "",
  "\t)def __init__(self%6(, %7(arg))):",
  "\t\t%8(super(%1, self).__init__())"
}, '\n')

You've missed the trailing newline. It's easy to make that mistake with so many escapes.

I'm not sure this commit is an improvement over longstrings.

@paaguti
Copy link
Author

paaguti commented May 18, 2022 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants