-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exercise_23.py
28 lines (21 loc) · 2.27 KB
/
Exercise_23.py
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
# #Exercise 23: read some code
# You should have spent last week getting your list of symbols straight and locked in your mind. Now you get to apply this to another week reading code on the internet. This exercise will be daunting at first. I'm going to throw you in the deep end for a few days and have you just try your best to read and understand some source code from real projects. The goal isn't to get you to understand code, but to teach you the following three skills:
# Finding Python source code for things you need.
# Reading through the code and looking for files.
# Trying to understand code you find.
# At your level you really do not have the skills to evaluate the things you find, but you can benefit from getting exposure and seeing how things look.
# When you do this exercise, think of yourself as an anthropologist, trucking through a new land with just barely enough of the local language to get around and survive. Except, of course, that you will actually get out alive because the internet isn't a jungle. Anyway.
# Here's what you do:
# Go to bitbucket.org with your favorite web browser and search for "python".
# Avoid any project with "Python 3" mentioned. That'll only confuse you.
# Pick a random project and click on it.
# Click on the Source tab and browse through the list of files and directories until you find a .py file (but not setup.py, that's useless).
# Start at the top and read through it, taking notes on what you think it does.
# If any symbols or strange words seem to interest you, write them down to research later.
# That's it. Your job is to use what you know so far and see if you can read the code and get a grasp of what it does. Try skimming the code first, and then read it in detail. Maybe also try taking very difficult parts and reading each symbol you know outloud.
# Now try several three other sites:
# github.com
# launchpad.net
# koders.com
# On each of these sites you may find weird files ending in .c so stick to .py files like the ones you have written in this book.
# A final fun thing to do is use the above four sources of Python code and type in topics you are interested in instead of "python". Search for "journalism", "cooking", "physics", or anything you are curious about. Chances are there's some code out there you could use right away.