Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add snippet for if __name__ == "__main__": block #2881

Merged
merged 6 commits into from
Oct 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions news/1 Enhancements/2242.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add a new simple snippet for `if __name__ == '__main__':` block. The snippet can be accessed by typing `__main__`
(thanks [R S Nikhil Krishna](https://github.com/rsnk96/))
11 changes: 4 additions & 7 deletions snippets/python.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,12 @@
"description": "Code snippet for a lambda statement"
},
"if(main)": {
"prefix": "if(main)",
"prefix": "__main__",
"body": [
"def main():",
"\t${1:pass}",
"",
"if __name__ == '__main__':",
"\tmain()"
"if __name__ == \"__main__\":",
" ${1:pass}",
],
"description": "Code snippet for a main function"
"description": "Code snippet for a `if __name__ == \"__main__\": ...` block"
},
"async/def": {
"prefix": "async/def",
Expand Down