File tree Expand file tree Collapse file tree 1 file changed +17
-11
lines changed Expand file tree Collapse file tree 1 file changed +17
-11
lines changed Original file line number Diff line number Diff line change 13
13
14
14
# %% [markdown]
15
15
# ## Coding Conventions
16
+ #
17
+ # Let's import a few variables from context.py that will be used in the following lesson.
18
+
19
+ # %%
20
+ from context import (
21
+ sEntry ,
22
+ iOffset ,
23
+ entry ,
24
+ offset ,
25
+ anothervariable ,
26
+ variable ,
27
+ flag1 ,
28
+ flag2 ,
29
+ do_something ,
30
+ )
31
+
32
+ # %% [markdown]
16
33
# ### One code, many layouts:
17
34
#
18
35
# Consider the following fragment of python:
@@ -135,8 +152,6 @@ def method_name(a_variable):
135
152
#
136
153
137
154
# %%
138
- sEntry = "10.0"
139
- iOffset = 1
140
155
fNumber = float (sEntry ) + iOffset
141
156
142
157
# %% [markdown]
@@ -145,8 +160,6 @@ def method_name(a_variable):
145
160
# People may find this useful in languages like Python where the type is intrisic in the variable.
146
161
147
162
# %%
148
- entry = "10.0"
149
- offset = 1
150
163
number = float (entry ) + offset
151
164
152
165
# %% [markdown]
@@ -167,13 +180,6 @@ def method_name(a_variable):
167
180
# The following two snippets do the same, but the second is separated into more steps, making it more readable.
168
181
169
182
# %%
170
- anothervariable = 1
171
- flag1 = True
172
- flag2 = False
173
- variable = 1
174
- anothervariable = 1
175
- def do_something (): pass
176
-
177
183
anothervariable += 1
178
184
if ((variable == anothervariable ) and flag1 or flag2 ): do_something ()
179
185
You can’t perform that action at this time.
0 commit comments