Hacker News new | ask | show | jobs
by apthnz 3097 days ago
On the "read code written by brilliant engineers" point, as someone just starting to learn Python, where would I find some?
6 comments

If there are engineers you highly respect on your team, their code is a great place to start.

Otherwise, many top tech companies now open source software that they've written internally, oftentimes with their own websites. And there is also a growing trend for them to actually maintain the software they open source as opposed to just throwing it over the fence.

Think of companies that have a strong engineering brand, and then just search for what open source software they're released. Pick whatever seems most aligned with your interests.

Some examples:

Google: https://opensource.google.com/projects/list/featured?languag... Facebook: https://code.facebook.com/projects/#backend Stripe: https://stripe.com/open-source Airbnb: http://airbnb.io/projects/

Lots of different ways:

- Find a function call you're making in a library and see how it works

- Look through the top python libraries (see https://github.com/vinta/awesome-python ) and pick a few of the simpler ones to flip through

For reading code, some things that can be useful:

- Flip through test suite and get tests running; then break some tests to see what's happening

- Diagram out code on a piece of paper (file structure, data structure, stack trace for a popular call)

- Discuss implementation with friends

- For certain files, it's often valuable to rewrite yourself

Peter Norvig has lots of expository code that embodies lots of good design.

I find I like to learn the flavor of different kinds of code, but practical codebases have so much stuff going on that it's not easy to find the distinctive part. It would be great to see more people do expository versions of familiar software and libraries.

+1 Here's a link to Norvig's (self annotated!) github repo: https://github.com/norvig/pytudes
Reading code is the equivalent of looking at solutions for math problems... is it more helpful reading the solutions without context or with? You need to see the original problem, and how the solution came about in response to that problem. In regard to this, I would say, pick a problem that has a solution (walkthrough, if possible) available and then attempt to solve it and then honestly check your solution against the given solution.
Anything written by Kenneth Reitz https://github.com/kennethreitz
Maybe find a very well received project on GitHub and check out the author and see some of his code