Page 104 -
P. 104
adding an argument
1 You were to amend your module one last time to add a third argument to your function. You were
to call your argument indent and set it initially to the value False—that is, do not switch on
indentation by default. In the body of your function, you were to use the value of indent to
control your indentation code.
Did you include the
default value?
indent=False
def print_lol(the_list, , level=0):
Your signature has changed,
for each_item in the_list: so be sure to update this
invocation.
if isinstance(each_item, list):
indent
print_lol(each_item, , level+1)
else:
A simple “if” if indent : Don’t forget the colon at the end of the “if” line.
statement does
for tab_stop in range(level):
the trick.
print("\t", end='')
print(each_item)
A sweet alternative to this “for” loop
is this code: print("\t" * level, end='').
With your new code additions in place, you were to provide the edit you would recommend
2
making to the setup.py program prior to uploading this latest version of your module to PyPI:
Edit “setup.py” so that it reads: version = ‘1.3.0’,
It’s a new version of your module, so be sure to change
the value associated with “version” in your “setup.py” file.
3 You were to provide the command you would use to upload your new distribution to PyPI:
python3 setup.py sdisk upload
Remember: if you are on Windows use “C:\Python31\python.exe”
instead of “python3”.
68 Chapter 2