-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython.code-snippets
95 lines (95 loc) · 2.55 KB
/
python.code-snippets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{
"The if Statement": {
"description": "Snippet for the if statement",
"body": ["if ${1:condition}:", "\t$0"],
"prefix": ["if", "ifc"],
"scope": "python"
},
"The if else Statement": {
"description": "Snippet for the if else statement",
"body": [
"if ${1:condition}:",
"\t${2:if_block}",
"else:",
"\t${3:else_block}",
"$0"
],
"prefix": ["ife", "ifec"],
"scope": "python"
},
"The elif statement": {
"description": "Snippet for the elif statement",
"body": ["elif ${1:condition}:", "\t${2:elif_block}"],
"prefix": ["el", "elif"],
"scope": "python"
},
"for Loop": {
"description": "for loop with custom Iterable",
"body": ["for ${1:i} in ${2:iterable}:", "\t${0:for_block}"],
"prefix": ["for"],
"scope": "python"
},
"for Loop with range": {
"description": "A For loop that iterates over value from the range function",
"body": ["for ${1:var} in range(${2:end}):", "\t${3:code_block}", "${0}"],
"prefix": ["forr", "forrange"],
"scope": "python"
},
"while Loop": {
"description": "A while loop with custom condition",
"body": ["while ${1:conditional}:", "\t${2:code_block}", "${0}"],
"prefix": ["while"],
"scope": "python"
},
"while Loop with a Counter variable": {
"description": "A while loop with a counter variable",
"body": [
"${1:var} = 0",
"while ${1:var}${2}:",
"\t${3:code_block}",
"\t${4:counter_change}",
"${0}"
],
"prefix": ["whilec", "whilecounter"],
"scope": "python"
},
"print": {
"description": "default print function",
"body": ["print(${1:to_print})", "$0"],
"prefix": ["print"],
"scope": "python"
},
"f-string": {
"description": "f-string",
"body": ["f\"${1}\"${0}"],
"prefix": ["fstr", "fstring"],
"scope": "python"
},
"evaluate object using f-strings": {
"description": "create a string with evaluation of the object using f-string",
"body": ["f\"{${1}=}\"${0}"],
"prefix": ["evalfstr"],
"scope": "python"
},
"function": {
"description": "creates a function skeleton",
"body": [
"def ${1:function_name}(${2:function_arguments}):",
"\t${3:function_body}",
"$0"
],
"prefix": ["def", "function"],
"scope": "python"
},
"class": {
"description": "creates a class skeleton with init",
"body": [
"class ${1:Class_name}:",
"\tdef __init__(self, ${2:constructor_args}):",
"\t\t${3:init_body}",
"\t${0}"
],
"prefix": ["class"],
"scope": "python"
}
}