分享

Exercise 23: Read Some Code

 集微轩 2013-08-04

You should have spent the last week getting your list of symbols straight and locked in your mind. Now you get to apply this to another week of 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:

  1. Finding Python source code for things you need.
  2. Reading through the code and looking for files.
  3. 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.

Here's what you do:

  1. Go to bitbucket.org, github.com, or gitorious.org with your favorite web browser and search for "python."
  2. Avoid any project that mentions "Python 3". That'll only confuse you.
  3. Pick a random project and click on it.
  4. 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).
  5. Start at the top and read through it, to take notes on what you think it does.
  6. 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 read each symbol you know out loud.

Now try some of these other sites:

  • github.com
  • launchpad.net
  • gitorious.org
  • sourceforge.net
  • freecode.com

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多