tag:blogger.com,1999:blog-57472084196599067772024-03-19T01:48:15.007-07:00AdkuCarlos Whitthttp://www.blogger.com/profile/14952553628432595368noreply@blogger.comBlogger20125tag:blogger.com,1999:blog-5747208419659906777.post-56706422094777972022012-02-06T13:32:00.000-08:002012-02-06T13:32:29.616-08:00Adku + Groupon<div><b id="internal-source-marker_0.9447650625370443"><span style="font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">We’re happy to announce that Groupon has acquired Adku!</span><br />
<span style="font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Adku started a year and a half ago from our passion for big data and a desire to create products that would instantly and automatically give users a more personalized experience. We had ambitious </span><a href="http://blog.adku.com/2010/12/why-did-we-start-adku.html"><span style="color: #1155cc; font-family: Arial; font-size: 15px; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">goals</span></a><span style="font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> and some of the most rewarding and busy days of our lives. We were also fortunate to assemble an amazing </span><a href="http://www.adku.com/about"><span style="color: #1155cc; font-family: Arial; font-size: 15px; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">team</span></a><span style="font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> of engineers and investors and create something special. </span><br />
<span style="font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">We started talking to Groupon to bring our technology to more customers and quickly realized that we wanted to be a deeper part of a company that people love and is empowering merchants and customers in a way that’s never been done before. </span><br />
<span style="font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">We’re looking forward to joining forces with Groupon to have an impact on millions of users and to share in Groupon’s vision of reshaping local commerce. </span><br />
<span style="font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">We want to express our sincere appreciation to our customers, advisors, and investors. We can’t begin to thank you enough for all the help you’ve given us.</span></b></div>Ajit Varmahttp://www.blogger.com/profile/15774628543200631695noreply@blogger.com456tag:blogger.com,1999:blog-5747208419659906777.post-49938906013279696562012-01-12T16:33:00.000-08:002012-02-05T12:04:55.641-08:00My Music Tastes are 13.3% Terrible, Says Algorithm<div style="background-color: transparent;"><span id="internal-source-marker_0.8745767644140869"><b><img src="https://lh3.googleusercontent.com/2NfDJGZk4_7evOixNhcPz8CiZPZhshF0YY3KtKuVaKTsPQ8OZ-bZvdBOYWnFhXQk2lHAZQTFDeDdqcE6lgCbx7U6UwKLIP3TK0Sz8pXrnRJ2DF260Aw" width="468px;" /></b><span class="Apple-style-span" style="background-color: transparent;"><b><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b></span><br />
<span class="Apple-style-span" style="background-color: transparent;"><b><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b></span><span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="font-size: 15px; white-space: pre-wrap;"><br />
</span></span><span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Adku engineers devote 20% of their time working on projects of their own choosing. These projects are usually a little bit more removed from our daily work and are a great outlet for chasing down some of our crazier ideas. Earlier, Leah </span><span style="background-color: transparent; color: #3d85c6; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;"><a href="http://blog.adku.com/2011/12/how-we-use-20-time-at-adku_20.html"><span style="color: #3d85c6;">wrote</span></a> </span><span style="background-color: transparent; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">about</span><span style="color: #3d85c6;"><span style="background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><a href="http://mildred.likelygifts.com/" style="font-weight: bold;"><span style="background-color: transparent; color: #3d85c6; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">Mildred</span></a></span><span style="background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, a “20% time” project for visualizing your friends’ Facebook likes. Visualizing data is a great way to intuitively spot patterns and draw some quick conclusions, but the real fun comes in automating that process with machine learning. Today, I’m going to explain how Latent Dirichlet Allocation works and how we used it to draw conclusions about people’s music tastes from their Facebook likes. </span></span></span><br />
<span style="background-color: transparent; font-family: Arial, Helvetica, sans-serif; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Latent Dirichlet Allocation (LDA) was </span><a href="http://scholar.google.com/scholar?q=blei+lda+2003&hl=en" style="font-weight: bold;"><span style="background-color: transparent; color: #3d85c6; font-weight: normal; vertical-align: baseline; white-space: pre-wrap;">invented in 2003</span></a><span style="background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> primarily for automatically inferring the topics in a text document (the original paper also mentions applications for collaborative filtering). For example, LDA could be used to determine that a bioinformatics scientific paper is about evolutionary biology and computers, or perhaps that a particular court case is concerned with torts and constitutional law. It works by applying statistical analysis on the words in the document. For the bioinformatics paper, LDA would recognize that the document contained words related to evolutionary biology like “genome” and “selection” as well as computer words like “big O” and “algorithm.” </span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The basic idea behind LDA is that every document is generated by a simple probabilistic model. Suppose we wanted to randomly generate a document using this probabilistic model. To begin, we select the topic(s) of the document by drawing a <span style="color: #38761d;">green</span> die out of a bag. There are many dice in the bag and each side of a die represents a topic. If we decide that there are 6 topics in all, then each <span style="color: #38761d;">green</span> die will have 6 sides. Drawing a die that is heavily weighted towards the “computer” and “evolutionary biology” topics means that the document will be about computers and evolutionary biology. There are also 6 <span style="color: red;">red</span> dice--one die for each topic. Each side of a <span style="color: red;">red</span> die represents a word. The <span style="color: red;">red</span> die for the computer topic, for example, will be heavily weighted toward words like “RAM” and “processor.”</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Here’s how each word in the document is generated. First, the </span><span style="color: #38761d; font-family: Arial, Helvetica, sans-serif;">green</span><span style="font-family: Arial, Helvetica, sans-serif;"> die is rolled to determine the topic of the word. The </span><span style="color: red; font-family: Arial, Helvetica, sans-serif;">red</span><span style="font-family: Arial, Helvetica, sans-serif;"> die corresponding to that topic is then rolled to determine the word itself.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">An example roll could have the </span><span style="color: #38761d; font-family: Arial, Helvetica, sans-serif;">green</span><span style="font-family: Arial, Helvetica, sans-serif;"> die giving us the topic “computers.” We then find the “computers” </span><span style="color: red; font-family: Arial, Helvetica, sans-serif;">red</span><span style="font-family: Arial, Helvetica, sans-serif;"> die and roll it, giving us the word “RAM.” “RAM” is appended to the document. Note that the order of the words generated is not taken into account at all; the document is just a “bag of words.”</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">All the variables involved in generating documents--the </span><span style="color: #38761d;">green</span> and <span style="color: red;">red</span> <span style="text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">dice, the assortment of dice in the bag--are so-called </span><span style="font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">latent</span><span style="text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> variables. The dice represent multinomials; the bag of dice represents a </span><span style="font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Dirichlet</span><span style="text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">.</span><span style="font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In the computer example, we assumed that the latent variables were known to us (</span><span style="font-style: italic; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">i.e.</span><span style="text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> we had dice and bags of dice to draw from). In real life, however, the latent variables are hidden from us. The only information we have are the words that are in each document. The goal of LDA is to figure out the values of the latent variables by working backwards (using Bayesian inference) from a collection of documents, and </span><span style="font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">allocate</span><span style="text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> each word in each document to a particular topic. </span></span></div><div style="background-color: transparent;"><span style="white-space: pre-wrap;"><span style="font-family: Arial, Helvetica, sans-serif;"> </span></span><br />
<span style="white-space: pre-wrap;"><span style="font-family: Arial, Helvetica, sans-serif;">Now that we know a little bit about how LDA works, applying it to Facebook likes is straightforward. Each person represents a document, and that person's likes is analogous to the words in a document. The Mildred visualization indicates that people tend to have more music likes, so we'll just look at music likes for now. This makes it easier to get an intuitive grasp for how good the LDA results are. If the topics recovered by LDA end up matching recognizable music genres, then it's probably doing something right. </span></span><br />
<span style="white-space: pre-wrap;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></span><br />
<span class="Apple-style-span" style="background-color: transparent;"><span style="background-color: transparent; font-family: Arial, Helvetica, sans-serif; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></span><br />
<span style="background-color: transparent; font-family: Arial, Helvetica, sans-serif; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The five most common likes for each topic as computed by LDA are shown in the tables below. The number of topics was arbitrarily set at 20. Some of the topics are labelled with a very heavy hand :-).</span></div><div style="background-color: transparent;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: 15px; white-space: pre-wrap;"><br />
</span></span><span class="Apple-style-span" style="background-color: transparent;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></span><br />
<div dir="ltr" style="font-weight: bold;"><table style="border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 624px;"><colgroup><col width="*"></col><col width="*"></col><col width="*"></col><col width="*"></col><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">1. Indie music I (n=869)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">2. Contemporary Pop (n=709)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">3. Oldies Pop (n=740)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">4. Rap and Hip Hop (n=736)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">5. 90’s (n=643)</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Radiohead</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Rihanna</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Pink Floyd</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Jay-Z</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Red Hot Chili Peppers</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Sufjan Stevens</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Lady Gaga</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The Beatles</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Kanye West</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Incubus</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Bon Iver</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Beyoncé</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Radiohead</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Lil Wayne</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Nirvana</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Belle & Sebastian</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Kanye West</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Queen</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Kid Cudi</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Sublime</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Wilco</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Katy Perry</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Metallica</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Eminem</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Pearl Jam</span></td></tr>
</tbody></table></div><br />
<span class="Apple-style-span" style="background-color: transparent;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></span><br />
<div dir="ltr" style="font-weight: bold;"><table style="border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 624px;"><colgroup><col width="*"></col><col width="*"></col><col width="*"></col><col width="*"></col><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">6. Pop (n=576)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">7. Electronic/Trance/House (n=442)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">8. 00’s (n=759)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">9. 90’s/00’s I (n=400)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">10. (n=375)</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Lady Gaga</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Tiësto</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Death Cab for Cutie</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">U2</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Lady Gaga</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Taylor Swift</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">deadmau5</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Coldplay</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Muse</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Coldplay</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Michael Jackson</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Lady Gaga</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The Killers</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Coldplay</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Jay Chou</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Beyoncé</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Daft Punk</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Muse</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Weezer</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">THE FU</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Katy Perry</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Armin van Buuren</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Weezer</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Oasis</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Eminem</span></td></tr>
</tbody></table></div><br />
<span class="Apple-style-span" style="background-color: transparent;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></span><br />
<span class="Apple-style-span" style="background-color: transparent;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></span><br />
<div dir="ltr" style="font-weight: bold;"><table style="border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 624px;"><colgroup><col width="*"></col><col width="*"></col><col width="*"></col><col width="*"></col><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">11. Emotional Male Singers I (n=404)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">12. Classics (n=700)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">13. (n=520)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">14. Rock (n=376)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">15. (n=276)</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">John Mayer</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The Beatles</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Bob Marley</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Red Hot Chili Peppers</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Lady Gaga</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Dave Matthews Band</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Bob Dylan</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Jack Johnson</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">AC/DC</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Carousel</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">U2</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Pink Floyd</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Johnny Cash</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Aerosmith</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The Beatles</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Jason Mraz</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Queen</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ben Harper</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Queen</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Dream Theater</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Jack Johnson</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The Doors</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">O.A.R.</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Van Halen</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Justin Diamond</span></td></tr>
</tbody></table></div><br />
<span class="Apple-style-span" style="background-color: transparent;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></span><br />
<div dir="ltr" style="font-weight: bold;"><table style="border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; width: 624px;"><colgroup><col width="*"></col><col width="*"></col><col width="*"></col><col width="*"></col><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">16. Emotional Male Signers II (n=620)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">17. 90’s/00’s II (n=872)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">18. Indie Music II (n=864)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">19. (n=497)</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">20. Classical (n=459)</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ben Folds</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Linkin Park</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Radiohead</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Regina Spektor</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The Beatles</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Coldplay</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Coldplay</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Arcade Fire</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The Beatles</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Beethoven</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Jack Johnson</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Green Day</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Daft Punk</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Frank Sinatra</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Mozart</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Dave Matthews Band</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Nickelback</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Beck</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Coldplay</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Chopin</span></td></tr>
<tr style="height: 0px;"><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">John Mayer</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The Fray</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">MGMT</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Michael Bublé</span></td><td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: dotted; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: dotted; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: dotted; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: dotted; border-top-width: 1px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; padding-top: 7px; vertical-align: top;"><span style="background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Bach</span></td></tr>
</tbody></table></div><br />
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt;"><div style="font-weight: bold;"><span style="background-color: transparent; font-family: Arial; font-size: 13px; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Table 1. The twenty topics recovered by running LDA on Facebook music likes. Only the five most common likes for each topic are shown. The number of likes classified within each topic is shown in parentheses. 1517 people with a collective total of 11837 music likes were analyzed.</span></div><br />
Just for fun, let’s take a look at how LDA classifies my music tastes. I have 15 music likes: <br />
<br />
Vampire Weekend, Arctic Monkeys, Death Cab for Cutie, Eric Clapton, Jack Johnson, The Killers, Oasis, Pink Floyd, Postal Service, Radiohead, Third Eye Blind, Weezer, Wilco, Muse and The Beatles. The majority of my likes (9/15) are classified under topic 8: 00’s music. Three of my likes are classified as topic 3, Oldies Pop. I also have two likes in topic 16 and one like in topic 19.<br />
<span style="font-family: Arial, Helvetica, sans-serif; text-align: left; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Arial, Helvetica, sans-serif; text-decoration: none; vertical-align: baseline;"><br />
</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; text-align: left; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Arial, Helvetica, sans-serif; text-decoration: none; vertical-align: baseline;">We can also look at </span><a href="http://www.adku.com/about" style="font-weight: bold;"><span style="color: #3d85c6; font-weight: normal; vertical-align: baseline;">Carlos</span></a><span style="font-family: Arial, Helvetica, sans-serif; text-decoration: none; vertical-align: baseline;">’ music preferences. He likes </span><span style="font-family: Arial, Helvetica, sans-serif; font-style: italic; text-decoration: none; vertical-align: baseline;">The Smashing Pumpkins</span><span style="font-family: Arial, Helvetica, sans-serif; text-decoration: none; vertical-align: baseline;">, </span><span style="font-family: Arial, Helvetica, sans-serif; font-style: italic; text-decoration: none; vertical-align: baseline;">The Killers, Coldplay, Pearl Jam, The Verve, Weezer, Quartus, Michael Jackson </span><span style="font-family: Arial, Helvetica, sans-serif; text-decoration: none; vertical-align: baseline;">and</span><span style="font-family: Arial, Helvetica, sans-serif; font-style: italic; text-decoration: none; vertical-align: baseline;"> Bush. </span><span style="font-family: Arial, Helvetica, sans-serif; text-decoration: none; vertical-align: baseline;">Carlos’ likes are evenly split between topics 3, 8 and 1: Oldies Pop, 00’s and Indie Music.</span></span></div><div style="text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">You could imagine several ways of building a simple recommendation engine from these results. A simple one is to use the generative process, just like how a we generated a “computer” document. The music recommendations for Carlos would come from a document that is generated from the Oldies Pop, 00’s and Indie Music topics. These recommendations are </span><span style="font-family: Arial, Helvetica, sans-serif; font-style: italic; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">explanable</span><span style="font-family: Arial, Helvetica, sans-serif; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. We can tell Carlos that </span><span style="font-family: Arial, Helvetica, sans-serif; font-style: italic; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Metallica</span><span style="font-family: Arial, Helvetica, sans-serif; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> was recommended because he likes Oldies Pop.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; white-space: pre-wrap;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; white-space: pre-wrap;">A fully fleshed out recommendation engine sounds like another 20% project, though. Until then, try not to snicker at my music tastes too much!</span></div></div>Anonymousnoreply@blogger.com465tag:blogger.com,1999:blog-5747208419659906777.post-53074019452804855622011-12-20T15:28:00.000-08:002011-12-20T15:46:01.638-08:00How we use 20% time at Adku<span style="font-family: inherit;"><br /></span><br />
<div>
<div class="c0" style="direction: ltr;">
<span class="c2" style="font-family: inherit; font-weight: bold;">Experiments in the social graph</span></div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
<span class="c2" style="font-family: inherit; font-weight: bold;"></span></div>
<div class="c0 c5" style="direction: ltr; text-indent: 36pt;">
<span style="font-family: inherit;">Here at Adku, we love data, and we are constantly looking for ways to leverage new sources of information to make our algorithms better. While our main line of research focuses on the relevance of signals such as demographics and click stream information, we’ve also recently been enamored with the possibilities of the social graph. A few of our engineers used 20% time to put together some hacks in this direction, and we would like to invite you to try them out.</span></div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
</div>
<div class="c0" style="direction: ltr;">
<span style="font-family: inherit;">1. Likelygifts (<a href="http://www.likelygifts.com/">http://www.likelygifts.com</a>)</span></div>
<div class="c0" style="direction: ltr;">
<span style="font-family: inherit;">2. Mildred (<a href="http://mildred.likelygifts.com/">http://mildred.likelygifts.com</a>)</span></div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
</div>
<div class="c0" style="direction: ltr;">
<span class="c2" style="font-family: inherit; font-weight: bold;">Now that you’ve tried them out...</span></div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
</div>
<div class="c0" style="direction: ltr;">
<span style="font-family: inherit;">Let us explain why we built these tools in the first place.</span></div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
</div>
<div class="c0" style="direction: ltr;">
<span class="c3" style="font-family: inherit; font-style: italic;">1. Likelygifts</span></div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
</div>
<div class="c0" style="direction: ltr;">
<span style="font-family: inherit;">In spite of what privacy “features”, Facebook, Google+, and Twitter roll out, your actions on a social network are inherently public. They can be culled and managed, but a like is a publicly stated preference, and a wall post is a publicly stated fact. For real privacy, you can use the phone, or meet in person. The broadcast nature of social networks is something that our culture has not fully mastered. Hence much of the rise of social networks has been accompanied by frauds, cons, and Farmville. <span style="background-color: white; line-height: 18px;">While social networking has exploded, useful derivatives of social networking have not. </span><span style="background-color: white; line-height: 18px;"> </span></span></div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
</div>
<div class="c0" style="direction: ltr;">
<span style="font-family: inherit;">We built Likelygifts in hopes of changing that. If you’re like us, you’ve just started panicking about all the gifts you have to send out by the end of the month. And who knows what third cousin Bob wants? Or the college buddy who has way too many toys? Maybe we can jog your memory.</span></div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
</div>
<div class="c0" style="direction: ltr;">
<span style="font-family: inherit;">Likelygifts doesn’t post on your wall, solicit your friends, or spy on you when you’re offline. We ask for the minimum amount of information to give you accurate recommendations, and that’s all we do.</span></div>
<div class="c0" style="direction: ltr;">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-Ck0G3C_ujCk/TvEd5qvd8nI/AAAAAAAAABM/eWv1qlzeQVI/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="http://2.bp.blogspot.com/-Ck0G3C_ujCk/TvEd5qvd8nI/AAAAAAAAABM/eWv1qlzeQVI/s320/1.png" width="320" /></a><a href="http://3.bp.blogspot.com/-aavhu0B5KgU/TvEd-pcYBtI/AAAAAAAAABU/C8pvyRicgGM/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="166" src="http://3.bp.blogspot.com/-aavhu0B5KgU/TvEd-pcYBtI/AAAAAAAAABU/C8pvyRicgGM/s320/2.png" width="320" /></a></div>
<br />
<span style="background-color: white; line-height: 18px;"><span style="font-family: inherit;">( a competitor's facebook permissions request vs. ours!)</span></span></div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
</div>
<div class="c0" style="direction: ltr;">
<span class="c3" style="font-family: inherit; font-style: italic;">2. Mildred</span></div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
</div>
<div class="c0" style="direction: ltr;">
<span style="font-family: inherit;">We built Mildred as a visualization tool for ourselves. After looking through rows and rows of aggregate statistics about our friends’ likes, we thought maybe there was a better way to see things.</span></div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
</div>
<div class="c0" style="direction: ltr;">
<span style="font-family: inherit;">But then we liked Mildred enough to show our friends, and they liked it enough that now we want to show you.</span></div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
</div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
Here are some screenshots:</div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
</div>
<div class="c0" style="direction: ltr;">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-ntDVasLaL70/TvEeHlxrvlI/AAAAAAAAABc/6eHWcc21HX4/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="297" src="http://2.bp.blogspot.com/-ntDVasLaL70/TvEeHlxrvlI/AAAAAAAAABc/6eHWcc21HX4/s400/3.png" width="400" /></a></div>
<br /></div>
<div class="c0" style="direction: ltr;">
<span style="font-family: inherit;">This is Carlos’s taste graph. Out of all of his friends, he alone likes ‘The Hills’. His other favorite ‘Lost’ is shared by a large number of his friends.</span></div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
</div>
<div class="c0" style="direction: ltr;">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-XEKM0hQBjrw/TvEeK237mzI/AAAAAAAAABk/lL20XqQaZWQ/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="http://1.bp.blogspot.com/-XEKM0hQBjrw/TvEeK237mzI/AAAAAAAAABk/lL20XqQaZWQ/s400/4.png" width="347" /></a></div>
<span style="font-family: inherit;">`</span></div>
<div class="c0" style="direction: ltr;">
<span style="font-family: inherit;">David likes ‘The Beatles’, ‘Pink Floyd’, …, and is solitary in his love for Klute.</span></div>
<div class="c0 c1" style="direction: ltr; height: 11pt;">
</div>
<span style="font-family: inherit;">The most interesting aspect of Mildred for us came from comparing the taste graphs for different people. We found that we could tell who the graph belonged to without even looking at the names. And though everyone seems to like The Beatles & Coldplay, the less well known tastes proved very useful for distinguishing people. Hence one of the upcoming 20% time projects: topic clustering on facebook likes. David is working on that right now, and I am sure something exciting will come of it soon. In the mean time, we'd love to hear suggestions for ways to play with this data.</span></div>Anonymousnoreply@blogger.com84tag:blogger.com,1999:blog-5747208419659906777.post-13245715219292600892011-11-03T15:31:00.000-07:002011-11-03T17:02:46.480-07:00<h3>Scope and Variable Binding in Python</h3><p class="c0" style="font-family: 'times new roman'; "><span>1. Python only has two notions of scope -- global and local. This means that if a variable is declared in a function, it is bound to the function. Otherwise it is bound to the global state. </span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c0"><span style="font-family: 'times new roman'; ">You can inspect everything that is bound globally by calling </span><span class="c1"><span class="Apple-style-span">globals()</span></span><span style="font-family: 'times new roman'; ">, and everything that is bound locally by calling </span><span class="c1"><span class="Apple-style-span">locals()</span></span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c0"><span style="font-family: 'times new roman'; ">2. In the following post I will investigate variable binding and scope in python via an interactive python session. That is, by example. If you want to follow along, check out the documentation for </span><span class="c9"><a class="c11" href="http://docs.python.org/library/functions.html#dir"><span class="Apple-style-span">dir()</span></a></span><span style="font-family: 'times new roman'; "> and </span><span class="c9"><a class="c11" href="http://docs.python.org/library/dis.html"><span class="Apple-style-span">dis</span></a></span><span style="font-family: 'times new roman'; ">.</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c7"></span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c7"></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="c7 c4"><i><b>Local modifications stay local</b></i></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="c7 c4"><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 11px; line-height: 14px; background-color: rgb(255, 255, 255); "></span></span></p><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><div class="line" id="LC1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c7 c4"><span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># define a global variable a</span></span></div><div class="line" id="LC2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c7 c4"><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">5</span></span></div><div class="line" id="LC3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c7 c4"><span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># modify a locally</span></span></div><div class="line" id="LC4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c7 c4"><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">2</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">def</span> <span class="nf" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 0, 0); font-weight: bold; ">foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">():</span></span></div><div class="line" id="LC5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c7 c4"> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">...</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">3</span></span></div><div class="line" id="LC6" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c7 c4"> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">...</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> </span></div><div class="line" id="LC7" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c7 c4"><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">3</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">()</span></span></div><div class="line" id="LC8" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c7 c4"><span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># did global a change?</span></span></div><div class="line" id="LC9" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c7 c4"><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">4</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span></span></div><div class="line" id="LC10" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c7 c4"><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">Out</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">4</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">5</span></span></div><div class="line" id="LC11" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c7 c4"><span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># nope.</span></span></div></pre><p></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c4"></span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c3"></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="c7 c4"><b><i>Global variables can be accessed but not modified</i></b></span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c3"></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 11px; line-height: 14px; background-color: rgb(255, 255, 255); "></span></p><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><div class="line" id="LC1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">10</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">5</span></div><div class="line" id="LC2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><br /></div><div class="line" id="LC3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">11</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">def</span> <span class="nf" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 0, 0); font-weight: bold; ">foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">():</span></div><div class="line" id="LC4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">print</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span></div><div class="line" id="LC5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> </div><div class="line" id="LC6" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><br /></div><div class="line" id="LC7" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">12</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">()</span></div><div class="line" id="LC8" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">5</span></div></pre><p></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c5"></span></p><p class="c0"><span style="font-family: 'times new roman'; ">In order to modify a function in global scope, you must declare it to be global first. The relevant difference is explained by the following byte code snippets. In the case where a is a local variable, </span><span class="c1">STORE_FAST</span><span style="font-family: 'times new roman'; "> is called, whereas in the case where a is a declared global, </span><span class="c1">STORE_GLOBAL</span><span style="font-family: 'times new roman'; "> is called.</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c5"></span></p><p class="c0" style="font-family: 'times new roman'; "><span>Compare:</span></p><p class="c0" style="font-family: 'times new roman'; "><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 11px; line-height: 14px; background-color: rgb(255, 255, 255); "></span></p><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><div class="line" id="LC1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">21</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">def</span> <span class="nf" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 0, 0); font-weight: bold; ">foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">():</span></div><div class="line" id="LC2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">3</span></div><div class="line" id="LC3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> </div><div class="line" id="LC4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><br /></div><div class="line" id="LC5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">22</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">dis</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">dis</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">foo</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">func_code</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span></div><div class="line" id="LC6" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">2</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">0</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">LOAD_CONST</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">3</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span></div><div class="line" id="LC7" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">3</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">STORE_FAST</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">0</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span></div><div class="line" id="LC8" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">6</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">LOAD_CONST</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">0</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="bp" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 153); ">None</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span></div><div class="line" id="LC9" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">9</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">RETURN_VALUE</span> </div></pre><p></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c5"></span></p><p class="c0" style="font-family: 'times new roman'; "><span>And: </span></p><p class="c0" style="font-family: 'times new roman'; "><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 11px; line-height: 14px; background-color: rgb(255, 255, 255); "></span></p><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><div class="line" id="LC1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">24</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">def</span> <span class="nf" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 0, 0); font-weight: bold; ">foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">():</span></div><div class="line" id="LC2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">global</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span></div><div class="line" id="LC3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">3</span></div><div class="line" id="LC4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> </div><div class="line" id="LC5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># modification is successful</span></div><div class="line" id="LC6" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">25</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">()</span></div><div class="line" id="LC7" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">26</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">print</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span></div><div class="line" id="LC8" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">3</span></div><div class="line" id="LC9" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">27</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">dis</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">dis</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">foo</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">func_code</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span></div><div class="line" id="LC10" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">3</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">0</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">LOAD_CONST</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">3</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span></div><div class="line" id="LC11" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">3</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">STORE_GLOBAL</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">0</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span></div><div class="line" id="LC12" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">6</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">LOAD_CONST</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">0</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="bp" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 153); ">None</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span></div><div class="line" id="LC13" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">9</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">RETURN_VALUE</span> </div></pre><p></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c4"></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="c4 c7"><b><i>Expressions are always in global scope.</i></b></span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c4"></span></p><p class="c0"><span><span class="Apple-style-span">As a review, expressions are constructs like </span><span class="Apple-style-span">if/while/for/try/except</span><span class="Apple-style-span">. The point below is made with if statements, but would apply equally to any of the others.</span></span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c4"></span></p><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 11px; line-height: 14px; background-color: rgb(255, 255, 255); "><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><div class="line" id="LC1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># b is first defined inside a trivially true if statement</span></div><div class="line" id="LC2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">6</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">if</span> <span class="bp" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 153); ">True</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span></div><div class="line" id="LC3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">...</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">b</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">21</span></div><div class="line" id="LC4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">...</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> </div><div class="line" id="LC5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># b is still defined globally</span></div><div class="line" id="LC6" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">7</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">b</span></div><div class="line" id="LC7" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">Out</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">7</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">21</span></div><div class="line" id="LC8" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><br /></div><div class="line" id="LC9" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># it does matter that the if statement is evaluated</span></div><div class="line" id="LC10" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">10</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">if</span> <span class="bp" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 153); ">False</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span></div><div class="line" id="LC11" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">b</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1337</span></div><div class="line" id="LC12" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> </div><div class="line" id="LC13" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">11</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">b</span></div></pre></span><p class="c0" style="font-family: 'times new roman'; "><span class="Apple-style-span" style="font-family: 'Bitstream Vera Sans Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">Out</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">11</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">21</span></span></p><p class="c0" style="font-family: 'times new roman'; ">This contrasts with other languages like C, where variables have block scope.</p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c5"></span></p><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 11px; line-height: 14px; background-color: rgb(255, 255, 255); "><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><div class="line" id="LC1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="cp" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 153); font-weight: bold; ">#include<stdio.h></stdio.h></span></div><div class="line" id="LC2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><br /></div><div class="line" id="LC3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="kt" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(68, 85, 136); font-weight: bold; ">int</span> <span class="nf" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 0, 0); font-weight: bold; ">main</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">()</span> </div><div class="line" id="LC4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">{</span></div><div class="line" id="LC5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">if</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span> </div><div class="line" id="LC6" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">{</span></div><div class="line" id="LC7" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="kt" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(68, 85, 136); font-weight: bold; ">int</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">6</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">;</span></div><div class="line" id="LC8" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">printf</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="s" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); ">"%d</span><span class="se" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); ">\n</span><span class="s" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); ">"</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">);</span></div><div class="line" id="LC9" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">}</span></div><div class="line" id="LC10" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">printf</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="s" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); ">"%d</span><span class="se" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); ">\n</span><span class="s" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); ">"</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">);</span></div><div class="line" id="LC11" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">return</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">0</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">;</span></div></pre></span><p class="c0" style="font-family: 'times new roman'; "><span class="Apple-style-span" style="font-family: 'Bitstream Vera Sans Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); ">}</span></p><p class="c0"><span style="font-family: 'times new roman'; ">for example, generates a compile time error: </span><span class="c5"><span class="Apple-style-span">‘a’ undeclared</span> </span><span style="font-family: 'times new roman'; ">at the second printf statement.</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c4"></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="c7 c4"><b><i>Nested Function Scope</i></b></span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c4"></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 11px; line-height: 14px; background-color: rgb(255, 255, 255); "></span></p><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><div class="line" id="LC1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># let’s see what happens here</span></div><div class="line" id="LC2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">18</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">def</span> <span class="nf" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 0, 0); font-weight: bold; ">foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">():</span></div><div class="line" id="LC3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">5</span></div><div class="line" id="LC4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">def</span> <span class="nf" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 0, 0); font-weight: bold; ">goo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">():</span></div><div class="line" id="LC5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">print</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span></div><div class="line" id="LC6" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">goo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">()</span></div><div class="line" id="LC7" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">19</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">()</span></div><div class="line" id="LC8" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">Out</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">19</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">5</span></div></pre><p></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c4"></span></p><p class="c0" style="font-family: 'times new roman'; "><span>Inner functions have access to the outer functions’ local variables. This is the basis of functional closures. Similar behavior occurs for lambdas.</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c4"></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 11px; line-height: 14px; background-color: rgb(255, 255, 255); "></span></p><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><div class="line" id="LC1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">23</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">def</span> <span class="nf" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 0, 0); font-weight: bold; ">foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">():</span></div><div class="line" id="LC2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">5</span></div><div class="line" id="LC3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">b</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">lambda</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)()</span></div><div class="line" id="LC4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">print</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">b</span></div><div class="line" id="LC5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">....</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> </div></pre><p></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c4"></span></p><p class="c0" style="font-family: 'times new roman'; "><span>The fact that functions and lambdas have access to external scope is useful for closures, but also opens up this common bug*:</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 11px; line-height: 14px; background-color: rgb(255, 255, 255); "><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><div class="line" id="LC1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># define a sequence of functions</span></div><div class="line" id="LC2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">40</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">fs</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[(</span><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">lambda</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">n</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">i</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">+</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">n</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">for</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">i</span> <span class="ow" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">in</span> <span class="nb" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 134, 179); ">xrange</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">10</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)]</span></div><div class="line" id="LC3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><br /></div><div class="line" id="LC4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># e.g.</span></div><div class="line" id="LC5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">41</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">fs</span></div><div class="line" id="LC6" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">Out</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">41</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> </div><div class="line" id="LC7" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; "><</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">function</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">__main__</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.<</span><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">lambda</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">>></span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span></div><div class="line" id="LC8" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; "><</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">function</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">__main__</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.<</span><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">lambda</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">>></span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span></div><div class="line" id="LC9" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; "><</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">function</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">__main__</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.<</span><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">lambda</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">>></span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span></div><div class="line" id="LC10" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; "><</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">function</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">__main__</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.<</span><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">lambda</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">>></span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span></div><div class="line" id="LC11" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; "><</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">function</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">__main__</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.<</span><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">lambda</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">>></span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span></div><div class="line" id="LC12" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; "><</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">function</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">__main__</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.<</span><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">lambda</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">>></span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span></div><div class="line" id="LC13" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; "><</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">function</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">__main__</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.<</span><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">lambda</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">>></span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span></div><div class="line" id="LC14" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; "><</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">function</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">__main__</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.<</span><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">lambda</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">>></span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span></div><div class="line" id="LC15" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; "><</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">function</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">__main__</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.<</span><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">lambda</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">>></span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span></div><div class="line" id="LC16" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; "><</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">function</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">__main__</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.<</span><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">lambda</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">>></span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]</span></div><div class="line" id="LC17" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><br /></div><div class="line" id="LC18" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># now apply one of the functions in the sequence</span></div><div class="line" id="LC19" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">43</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">fs</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">0</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">](</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">3</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span></div></pre></span><p class="c0" style="font-family: 'times new roman'; "><span class="Apple-style-span" style="font-family: 'Bitstream Vera Sans Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">Out</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">43</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">12</span> <span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># wait...wtf?</span></span></p><p class="c0" style="font-family: 'times new roman'; ">Let’s see exactly what’s happening here, just for fun:</p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 11px; line-height: 14px; background-color: rgb(255, 255, 255); "><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><div class="line" id="LC1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">49</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">dis</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">dis</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">i</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">func_code</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">for</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">i</span> <span class="ow" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">in</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">fs</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]</span></div><div class="line" id="LC2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">0</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">LOAD_GLOBAL</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">0</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">i</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span></div><div class="line" id="LC3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">3</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">LOAD_FAST</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">0</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">n</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span></div><div class="line" id="LC4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">6</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">BINARY_ADD</span> </div><div class="line" id="LC5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">7</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">RETURN_VALUE</span> </div><div class="line" id="LC6" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">0</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">LOAD_GLOBAL</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">0</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">i</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span></div><div class="line" id="LC7" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">3</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">LOAD_FAST</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">0</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">n</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span></div><div class="line" id="LC8" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">6</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">BINARY_ADD</span> </div><div class="line" id="LC9" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">7</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">RETURN_VALUE</span> </div><div class="line" id="LC10" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span></div><div class="line" id="LC11" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span></div><div class="line" id="LC12" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span></div></pre></span><p class="c0" style="font-family: 'times new roman'; "><span class="c8"><span class="Apple-style-span" style="font-family: 'Bitstream Vera Sans Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; "><</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">snipped</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">></span></span></span></p><p class="c0"><span class="c8" style="font-family: 'times new roman'; ">The lambda loads </span><span class="c1">i</span><span class="c8" style="font-family: 'times new roman'; "> from globals, because </span><span class="c8">i</span><span class="c8" style="font-family: 'times new roman'; "> cannot be found within its local scope. But during the construction of the function sequence, </span><span class="c1" style="font-family: 'times new roman'; ">i</span><span class="c8" style="font-family: 'times new roman'; "> changes. By the time any of the functions are called, </span><span class="c1" style="font-family: 'times new roman'; ">i </span><span class="c8" style="font-family: 'times new roman'; ">has been incremented to 9, and so </span><span class="c1">fs[0][3]</span><span class="c8" style="font-family: 'times new roman'; "> doesn’t add </span><span class="c1" style="font-family: 'times new roman'; ">0</span><span class="c8" style="font-family: 'times new roman'; "> to </span><span class="c1" style="font-family: 'times new roman'; ">3</span><span class="c8" style="font-family: 'times new roman'; "> but rather </span><span class="c1" style="font-family: 'times new roman'; ">9</span><span class="c8" style="font-family: 'times new roman'; "> to </span><span class="c1" style="font-family: 'times new roman'; ">3</span><span class="c8" style="font-family: 'times new roman'; ">. This is reflected in the byte code by the</span><span class="Apple-style-span"><span class="c8"> </span><span class="c1">LOAD_GLOBAL</span></span><span class="c8" style="font-family: 'times new roman'; "> instruction.</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c8"></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="c8">To avoid problems like this one, remember that python will always look for unknown function variables in global (or higher level function) scope.</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c8"></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="c7 c4"><b><i>Class vs Instance vs method scope</i></b></span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c4"></span></p><p class="c0" style="font-family: 'times new roman'; "><span>Scope behaves in the same way for functions as for classes and objects. In fact, functions </span><span class="c4">are </span><span>objects. If you have some experience with python, you probably already know how to define class variables and instance variables. Class variables are declared under the class declaration, and outside of any functions. Instance variables are defined attached to self, as follows:</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 11px; line-height: 14px; background-color: rgb(255, 255, 255); "></span></p><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><div class="line" id="LC1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">class</span> <span class="nc" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(68, 85, 136); font-weight: bold; ">Foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="nb" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 134, 179); ">object</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">):</span></div><div class="line" id="LC2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># class variable</span></div><div class="line" id="LC3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">a_class_var</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="s" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); ">'yo yo'</span></div><div class="line" id="LC4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> </div><div class="line" id="LC5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">def</span> <span class="nf" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 0, 0); font-weight: bold; ">__init__</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="bp" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 153); ">self</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">):</span></div><div class="line" id="LC6" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># instance variable</span></div><div class="line" id="LC7" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="bp" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 153); ">self</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">an_instance_var</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="s" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); ">'whattttt'</span></div></pre><p></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c0"><span><span class="Apple-style-span">Brief Exercise for the reader: input the above into ipython, and compare </span><span class="Apple-style-span">dir(Foo)</span><span class="Apple-style-span">with </span><span class="Apple-style-span">dir(Foo())</span></span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c0" style="font-family: 'times new roman'; "><span>Consider the following class</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 11px; line-height: 14px; background-color: rgb(255, 255, 255); "></span></p><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><div class="line" id="LC1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">class</span> <span class="nc" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(68, 85, 136); font-weight: bold; ">Foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="nb" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 134, 179); ">object</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">):</span></div><div class="line" id="LC2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># class variable</span></div><div class="line" id="LC3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">x</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="s" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); ">'yo yo'</span></div><div class="line" id="LC4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><br /></div><div class="line" id="LC5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">bar</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">Foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">()</span></div></pre><p></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c0"><span style="font-family: 'times new roman'; ">What is </span><span class="c1">bar.x</span><span style="font-family: 'times new roman'; ">?</span></p><p class="c0"><span style="font-family: 'times new roman'; ">What is </span><span class="c1">Foo.x</span><span style="font-family: 'times new roman'; ">?</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="c7">Solution:</span><span> Both are ‘yo yo’</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c0" style="font-family: 'times new roman'; "><span>How about this class?</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 11px; line-height: 14px; background-color: rgb(255, 255, 255); "><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><div class="line" id="LC1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">class</span> <span class="nc" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(68, 85, 136); font-weight: bold; ">Foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="nb" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 134, 179); ">object</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">):</span></div><div class="line" id="LC2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">x</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="s" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); ">'yo yo'</span></div><div class="line" id="LC3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> </div><div class="line" id="LC4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">def</span> <span class="nf" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 0, 0); font-weight: bold; ">__init__</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="bp" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 153); ">self</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">):</span></div><div class="line" id="LC5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># print self.x</span></div><div class="line" id="LC6" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="bp" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 153); ">self</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">x</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="s" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); ">'whattttt'</span> </div><div class="line" id="LC7" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="c" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 136); font-style: italic; "># print self.x</span></div><div class="line" id="LC8" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><br /></div></pre></span><p class="c0" style="font-family: 'times new roman'; "><span class="Apple-style-span" style="font-family: 'Bitstream Vera Sans Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">bar</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">Foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">()</span></span></p><p class="c0" style="font-family: 'times new roman'; "><span>Now, </span></p><p class="c0"><span style="font-family: 'times new roman'; ">What is </span><span class="c10">bar.x</span><span style="font-family: 'times new roman'; ">?</span></p><p class="c0"><span style="font-family: 'times new roman'; ">What is </span><span class="c1">Foo.x</span><span style="font-family: 'times new roman'; ">?</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c0"><span style="font-family: 'times new roman'; ">In this case, </span><span class="c1">bar.x= ‘whattttt’</span><span style="font-family: 'times new roman'; "> and </span><span class="c10">Foo.x = ‘yo yo’</span><span style="font-family: 'times new roman'; ">. If you uncomment the print statements though, you’ll notice that initially </span><span class="c5">self.x = ‘yo yo’</span><span style="font-family: 'times new roman'; ">. Huh? </span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c0"><span style="font-family: 'times new roman'; ">Conceptually, we can think of </span><span>Foo</span><span style="font-family: 'times new roman'; "> as a template for all of it’s instances. The class variable </span><span class="c1">x</span><span style="font-family: 'times new roman'; ">, declared as </span><span class="c1" style="font-family: 'times new roman'; ">‘yo yo’</span><span style="font-family: 'times new roman'; "> gets copied to the instance bar on creation. </span><span class="c1">self.x</span><span><span class="Apple-style-span"> in the initializer is not referring to the class’s </span></span><span class="c1">x</span><span style="font-family: 'times new roman'; ">, but rather to the instance’s </span><span class="c10">x</span><span style="font-family: 'times new roman'; ">. We never tamper with the class’s </span><span>x</span><span style="font-family: 'times new roman'; "> at all. If you do want to change </span><span>Foo</span><span style="font-family: 'times new roman'; ">’s </span><span class="c5">x</span><span style="font-family: 'times new roman'; ">, you would set </span><span class="c1">self.__class__.blah</span><span style="font-family: 'times new roman'; ">.</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c0"><span><span class="Apple-style-span">One important thing to note is that creating </span><span class="Apple-style-span">foo</span><span class="Apple-style-span"> from </span><span class="Apple-style-span">Foo</span><span class="Apple-style-span"> does a shallow copy of </span></span><span class="Apple-style-span">Foo</span><span class="Apple-style-span" style="font-family: 'times new roman'; ">’s internals. So</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 11px; line-height: 14px; background-color: rgb(255, 255, 255); "><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><div class="line" id="LC1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">class</span> <span class="nc" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(68, 85, 136); font-weight: bold; ">Foo2</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="nb" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 134, 179); ">object</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">):</span></div><div class="line" id="LC2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">hi</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[]</span></div><div class="line" id="LC3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">def</span> <span class="nf" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 0, 0); font-weight: bold; ">__init__</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="bp" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 153); ">self</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">):</span></div><div class="line" id="LC4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="bp" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 153, 153); ">self</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">hi</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">append</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="s" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); ">'1'</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span></div><div class="line" id="LC5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><br /></div><div class="line" id="LC6" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">bar2</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">Foo2</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">()</span></div><div class="line" id="LC7" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">print</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">bar2</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">hi</span></div><div class="line" id="LC8" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">bar3</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">Foo2</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">()</span></div><div class="line" id="LC9" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">print</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">bar3</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">hi</span></div><div class="line" id="LC10" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">print</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">Foo2</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">hi</span></div></pre></span><span class="Apple-style-span" style="line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; "><div style="font-size: 12px; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><span class="Apple-style-span" style="font-family: 'Bitstream Vera Sans Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; "><br /></span></span></div><div><span class="Apple-style-span" style="line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; "><span class="Apple-style-span">produces the output:</span></span></span></div><span class="Apple-style-span" style="font-size: 12px; ">[</span></span><span class="mi" style="font-size: 12px; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span><span class="p" style="font-size: 12px; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]</span></span><div><span class="Apple-style-span" style="font-family: 'Bitstream Vera Sans Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]</span></span><div><span class="Apple-style-span" style="font-family: 'Bitstream Vera Sans Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255); "><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]</span></span><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: 12px; line-height: 16px; white-space: pre;"><br /></span></span><p class="c0"><span class="Apple-style-span" style="font-family: 'times new roman'; ">The class</span><span class="Apple-style-span"> Foo2</span><span class="Apple-style-span">’s copy of </span><span class="Apple-style-span">hi</span><span class="Apple-style-span"> was modified by its instances because on instance creation, a reference to </span><span class="Apple-style-span">hi</span><span class="Apple-style-span"> was copied, but not</span><span class="Apple-style-span"> hi</span><span class="Apple-style-span"> itself. You may have seen this error disguised as:</span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 11px; line-height: 14px; background-color: rgb(255, 255, 255); "></span></p><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; "><div class="line" id="LC1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">def</span> <span class="nf" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(153, 0, 0); font-weight: bold; ">foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">blah</span> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">=</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[]):</span></div><div class="line" id="LC2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">...</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">blah</span><span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">.</span><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">append</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">(</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">)</span></div><div class="line" id="LC3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">...</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> <span class="k" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">return</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">blah</span></div><div class="line" id="LC4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "> <span class="o" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; font-weight: bold; ">...</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">:</span> </div><div class="line" id="LC5" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">2</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">()</span></div><div class="line" id="LC6" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">Out</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">2</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]</span></div><div class="line" id="LC7" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">3</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">()</span></div><div class="line" id="LC8" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">Out</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">3</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]</span></div><div class="line" id="LC9" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">In</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">4</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">foo</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">()</span></div><div class="line" id="LC10" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "><span class="n" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">Out</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">4</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]:</span> <span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">[</span><span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">,</span> <span class="mi" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(0, 153, 153); ">1</span><span class="p" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; ">]</span></div></pre><p></p><p class="c2 c0" style="font-family: 'times new roman'; "><span></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="c7 c4"><b><i>End</i></b></span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c7"></span></p><p class="c0"><span><span class="Apple-style-span">Hopefully these examples have given you some intuition about scope in python. For more detailed explanations of the examples in this post, check out the Python Language Reference. Or try out your own explorations in </span><span class="Apple-style-span">ipython</span><span class="Apple-style-span">. </span></span></p><p class="c2 c0" style="font-family: 'times new roman'; "><span class="c4"></span></p><p class="c0" style="font-family: 'times new roman'; "><span class="c9"><a class="c11" href="https://docs.google.com/a/adku.com/document/pub?id=1wWOgYVQ2ajVr76_7GR6TkK6wW6eVB5ruwWFA_2r4m7I">*http://math.andrej.com/2009/04/09/pythons-lambda-is-broken/</a></span> inspired by this post. Even though the title of that article seems strongly worded. It appears that Guido agrees: <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=98196">http://www.artima.com/weblogs/viewpost.jsp?thread=98196</a></p><p></p></div></div>Anonymousnoreply@blogger.com91tag:blogger.com,1999:blog-5747208419659906777.post-7752166130368626792011-10-11T11:58:00.000-07:002011-10-11T11:58:34.807-07:00Speed feels goodSitting in front of my computer typing at over 120 words-per-minute feels DAMN good.. damn good. or at least I imagine it would be if I could actually type 120wpm. Sadly, as much as I try, I can't type that fast, but.. I *can* cheat my way into working as fast as my fictional friend, let's call him Carlos, can (or faster, shhh!).<br />
<br />
There are probably better methods of working faster out there, but in this post, I want to convince you that you should alias your already short commands to be even shorter and how doing that will make both your fingers more efficient AND your brain more efficient.<br />
<br />
<h2>Efficient Fingers</h2>How many times a day do you type "ls"? 100? 1000? If you <br />
<script src="https://gist.github.com/1278984.js"> </script> you would save 33% of the number of keystrokes used to issue that command (including the enter key). 33% is pretty damn significant. That's 100-1000 keystrokes less per day. Your fingers are already looking like body builders you type-a-holic, they don't need to be working out any harder than they need to.<br />
<br />
What about "cd .."? <br />
<script src="https://gist.github.com/1278985.js"> </script> increases your productivity by 300%! That's like 200 less keystrokes a day? <br />
<br />
Not to belabor the point, but how many times do you type "cd" and don't immediately type "ls" afterwards? <br />
<script src="https://gist.github.com/1278987.js"> </script><br />
Here are some common ones I use daily. <br />
<script src="https://gist.github.com/1278977.js"> </script><br />
You may have noticed that I chose "d" and "s" for these common commands. The reason is because "d" and "s" are on the home row of your qwerty keyboard. This means your fingers have a shorter distance to travel which means MORE SPEED. They are also for your left hand so that your right hand can sit on top of the enter key ready and waiting so that it can get all up on that enter key RIGHT AFTER you type your 1-letter command. 2 hands are better than 1.<br />
<br />
You can alias all day long and find longer and longer commands that you type often. Things like "ssh -i ec2-keypair ubuntu@ec2.adku.com" or "cd /mnt/var/log/supervisor" each of which I do 100 times a day have their own aliases, saving me completely UNFATHOMABLE amounts of time. I seriously can't even comprehend the savings. <br />
<br />
Anyway, the point is, (fictional) Carlos may type faster than me, but that doesn't mean he gets more done than me =)<br />
<br />
<h2>Efficient Brain</h2>In practice, after years of obsessing over aliases and reducing keystrokes, I've unexpectedly found that the productivity gain is actually quite a bit more than just the reduced mechanical overhead of hitting keys. It also allows you to work that much closer to the speed of thought, eliminating the costly context switch of deciding what to do vs executing the commands. We all know how expensive context switching is when writing code, but there is a much smaller, but more pervasive context switch that happens between the time you decide you want to look at your log files and when your actually able to see them. Sometimes you get to the right folder and forget what you were looking for. Getting to your log files in 3 seconds instead of 10 seconds turns out to be a big difference and lets you keep your mind on what your doing and less on telling your fingers what buttons to push == SPEED x 1000!<br />
<br />
If you like working fast and getting a lot done, consider <a href="mailto:jobs@adku.com">applying for a job at Adku</a>.Jesse Shiehhttp://www.blogger.com/profile/02370410110943148171noreply@blogger.com85tag:blogger.com,1999:blog-5747208419659906777.post-18335913799817297212011-10-03T16:49:00.000-07:002011-10-03T16:51:17.227-07:00Scalable realtime stats with Graphite<div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: large;">Introduction</span></div><hr style="font-family: Arial,Helvetica,sans-serif;" /><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">Here at Adku, we’re always looking for ways to move faster and smarter. There’s nothing worse than having to wait a day or two to see if a code push has a positive or negative effect on our bottom line. One way to track application issues is to create a stat and graph it. While there’s a litany of solutions out there today, we’re using Graphite, a realtime graphing framework and we love what its done for us thus far. Here’s what Graphite can do:</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><a href="http://graphite.wikidot.com/screen-shots">http://graphite.wikidot.com/screen-shots</a></div><div style="font-family: Arial,Helvetica,sans-serif;"><a href="http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/">http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/</a></div><div style="font-family: Arial,Helvetica,sans-serif;"></div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">We recently went through the process of setting up our own Graphite cluster and below are the references/steps that we used to get everything running. We hope this helps :)</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: large;">Graphite installation guide</span></div><hr style="font-family: Arial,Helvetica,sans-serif;" /><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">This guide will install all the software packages required to get you up and running. Graphite will be setup to run across multiple machines. NOTE, these steps are virtually verbatim copies of our setup scripts. We are assuming you’re working with a clean Ubuntu 10.04 LTS installation (we’re using Ubuntu AMIs on EC2) We will NOT be delving into specifics for all non-Graphite related apps. In case you’re curious, this guide will install the following packages:</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">Process control - <b>supervisor</b> - akin to init.d</div><div style="font-family: Arial,Helvetica,sans-serif;">Web serving - <b>nginx, uwsgi</b> - akin to apache + mod_wsgi/mod_python</div><div style="font-family: Arial,Helvetica,sans-serif;">Caching - <b>memcached</b></div><div style="font-family: Arial,Helvetica,sans-serif;">Stats collection - <b>statsite</b> - akin to Etsy’s statsd without a dependency on node.js</div><div style="font-family: Arial,Helvetica,sans-serif;">Graphite - <b>graphite-web, carbon, whisper</b> - required for stats collection</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><b>Step 1</b> - <a href="http://dl.dropbox.com/u/26613348/blog-post-graphite.zip">Download our example configs</a></div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><b>Step 2</b> - Run bootstrap.sh</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><b>Step 3</b> - Copy all files from the archive into /etc and /opt respectively</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><b>Step 4</b> - Update following config variables</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">/etc/nginx/nginx.conf - worker processes (line 4)</div><div style="font-family: Arial,Helvetica,sans-serif;">/etc/nginx/sites-enabled/graphite - public hostname (line 3)</div><div style="font-family: Arial,Helvetica,sans-serif;">/etc/supervisor/supervisord.conf - web processes (line 39)</div><div style="font-family: Arial,Helvetica,sans-serif;">/opt/graphite/conf/carbon.conf - storage dir and cluster servers (line 2 and line 96)</div><div style="font-family: Arial,Helvetica,sans-serif;">/opt/graphite/conf/relay-rules.conf - cluster servers (line 3)</div><div style="font-family: Arial,Helvetica,sans-serif;">/opt/graphite/conf/storage-schemas.conf - retention times (line 4 - optional)</div><div style="font-family: Arial,Helvetica,sans-serif;">/opt/graphite/webapp/graphite/local_settings.py - storage dir and cluster servers (all lines)</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><b>Step 5</b> - Setup the graphite-web - Django app</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">cd /opt/graphite/webapp/graphite</div><div style="font-family: Arial,Helvetica,sans-serif;">yes no | python manage.py syncdb</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><b>Step 6</b> - Spin up supervisord - should spin up all other processes</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">sudo supervisorctl status</div><div style="font-family: Arial,Helvetica,sans-serif;">sudo supervisord (only if needed)</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><b>Step 7</b> - Ensure that our processes didn’t blow up</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">sudo tail -f /var/log/supervisor/*.log</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><b>Step 8</b> - Feed stats to your cluster. For a list of clients see</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">PHP / Java - <a href="https://github.com/etsy/statsd">https://github.com/etsy/statsd</a></div><div style="font-family: Arial,Helvetica,sans-serif;">Python - <a href="http://pypi.python.org/pypi/python-statsd">http://pypi.python.org/pypi/python-statsd</a></div><div style="font-family: Arial,Helvetica,sans-serif;">Ruby - <a href="https://github.com/dawanda/statsd-client">https://github.com/dawanda/statsd-client</a></div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><b>Step 9</b> - Check your stats server that your stat showed up!</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">http://statsd.yourhost.com:7001/</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: large;">Further reference</span></div><hr style="font-family: Arial,Helvetica,sans-serif;" /><div style="font-family: Arial,Helvetica,sans-serif;">Graphite</div><div style="font-family: Arial,Helvetica,sans-serif;"><a href="http://graphite.wikidot.com/screen-shots">http://graphite.wikidot.com/screen-shots</a></div><div style="font-family: Arial,Helvetica,sans-serif;"><a href="http://readthedocs.org/docs/graphite/en/1.0/">http://readthedocs.org/docs/graphite/en/1.0/</a></div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">nginx/uwsgi - used for web serving</div><div style="font-family: Arial,Helvetica,sans-serif;"><a href="http://wiki.nginx.org/Configuration">http://wiki.nginx.org/Configuration</a></div><div style="font-family: Arial,Helvetica,sans-serif;"><a href="http://blog.martinfjordvald.com/2010/07/nginx-primer/">http://blog.martinfjordvald.com/2010/07/nginx-primer/</a></div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">statsite - Python implementation of Etsy’s statsd</div><div style="font-family: Arial,Helvetica,sans-serif;"><a href="https://github.com/kiip/statsite">https://github.com/kiip/statsite</a></div><div style="font-family: Arial,Helvetica,sans-serif;"><a href="http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/">http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/</a></div>Anonymousnoreply@blogger.com37tag:blogger.com,1999:blog-5747208419659906777.post-85224658394672235612011-09-15T13:05:00.000-07:002011-10-03T16:46:49.319-07:00A Hodgepodge of Python<span class="Apple-style-span" style="font-family: Arial; font-size: 15px;"></span><br />
<div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Here at Adku, we do most of our development in Python. Python is concise, expressive, and well suited to rapid prototyping and readable code. I must admit though, I was initially skeptical of the choice to use Python. In my mind, dynamic typing = bugs, interpreted language = slow. Ahhhhh! But slowly my misgivings have disappeared, and I’ve come to really appreciate the Python Language for the wide coverage of its standard library, and the elegant design of many of the idioms.</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">For the rest of this post, I’d like to go over three of my favorite python features.</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c0" style="font-family: Arial, Helvetica, sans-serif; font-weight: bold;">The timeit module</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c0" style="font-family: Arial, Helvetica, sans-serif; font-weight: bold;"></span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">My initial worries about python’s performance versus traditional compiled languages have turned out to be irrelevant*. But in the few times when I’ve had some cause for worry, I found python’s <span class="c3">timeit</span> module to be a great help. Unlike other profiling modules, <span class="c3">timeit</span> can be run strictly from the command line. So we can quickly answer questions such as the following.</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c4" style="font-family: Arial, Helvetica, sans-serif; font-style: italic;">how much is xrange was faster than range?</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">:~/ $ python -m timeit 'for i in xrange(1000): continue' </span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">100000 loops, best of 3: 19.1 usec per loop</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">:~/ $ python -m timeit 'for i in range(1000): continue' </span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">10000 loops, best of 3: 24.6 usec per loop</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c4" style="font-family: Arial, Helvetica, sans-serif; font-style: italic;">What is the fastest way to reverse a list?</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">:~/ $ python -m timeit 'l=range(1000)' 'l[::-1]' </span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">100000 loops, best of 3: 12.3 usec per loop</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">:~/ $ python -m timeit 'l=range(1000)' 'l.reverse()' </span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">100000 loops, best of 3: 8.85 usec per loop</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">And as you’ll notice from the second example, even simple multiline programs can be timed; just separate lines with quotes.</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c0" style="font-family: Arial, Helvetica, sans-serif; font-weight: bold;"></span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">* a poor algorithm seems to be more often responsible.</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">** Matt just pointed out to me that more detailed profiling can be obtained with a cProfile (two)liner</span></div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="background-color: white;">python -m cProfile (your script path) > timing.txt<br />
</span><span class="Apple-style-span" style="background-color: white;">cat timing.txt | sort -snk 4 | tail -n 50</span></span><br />
<div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-weight: bold;">zip</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c0" style="font-family: Arial, Helvetica, sans-serif; font-weight: bold;"> </span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">You can read about zip here: http://docs.python.org/library/functions.html#zip. The way I like to think about it is: if nested for loops are like walking through a matrix element by element, zip allows you to just “zip” down the diagonal.</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Generally, zip is used to combine columns or rows of data. But there are two uses cases which I think are really cool.</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c4" style="font-family: Arial, Helvetica, sans-serif; font-style: italic;">Matrix transpose:</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c4" style="font-family: Arial, Helvetica, sans-serif; font-style: italic;"></span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Suppose we are given a matrix expressed as a nested list:</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">a = [[...],...[...]]</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Then we can find the transpose of this matrix by writing</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">zip(*a)</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c4" style="font-family: Arial, Helvetica, sans-serif; font-style: italic;">Grouping a list:</span></div><div class="c1 c2" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c4" style="font-family: Arial, Helvetica, sans-serif; font-style: italic;"></span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Suppose we have a list</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">a = [x1, x2, x3, …, xn]</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Then we can group it into <span class="c3">[(x1,x2), (x3,x4), … (xn-1,xn)] </span>by writing</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">zip(*[iter(a)]*2)</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Replace 2 with any integer k, and you can make k groups.</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The main thing to understand in both of these examples is the * operator. In python, * has the usual meaning of multiplication when it’s a binary operator, but as a unary operator it unzip a list and pass it as arguments to a function. Aside from that though, both of these examples just require some staring and thinking to understand. But it’s worth it! I promise</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c0" style="font-family: Arial, Helvetica, sans-serif; font-weight: bold;">collections.defaultdict</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">With collections.defaultdict, you can set a default value to the dictionaries you create. No more</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">a = {}</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">…</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;"> if not ‘foo’ in a:</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;"> a[‘foo’] = 0</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;"> else:</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;"> a[‘foo’] += 1</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">…</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Just do</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">a = collections.defaultdict(int)</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">…</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;"> a[‘foo’] += 1</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">...</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c0" style="font-family: Arial, Helvetica, sans-serif; font-weight: bold;"></span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">If you want, you can also do nested dictionaries. For example,</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c3" style="font-family: Arial, Helvetica, sans-serif;">a = collections.defaultdict(lambda: collections.defaultdict(int))</span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">will initialized a “matrix” of all zeroes.</span></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div class="c2 c1" style="direction: ltr; height: 11pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="c0" style="font-family: Arial, Helvetica, sans-serif; font-weight: bold;"></span></div><div class="c1" style="direction: ltr; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">That’s it for now. I would love to hear about more python features in the comments.</span></div></div>Anonymousnoreply@blogger.com66tag:blogger.com,1999:blog-5747208419659906777.post-68705174310400810712011-08-16T17:52:00.000-07:002011-08-18T10:07:59.220-07:00pip - python package management<div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">If you’ve ever developed a Python application before, you may be familiar with the litany of packages you need to get everything running. You might start off your web app with Django then add in Jinja2 to get some template speedups. From there, you might want some additional speed so you install packages like Cython, MarksupSafe, and simplejson for their C-extensions. After that, you realize you might want to dabble around with PyMongo as well. You go back to hacking for a while until you start thinking to yourself... how am I ever going to manage all these 3rd party packages? Luckily for us, things aren’t as dire as they seem. Python package management has gotten a lot better over the last few years thanks in part to PyPi, Python’s central package repository and a tool called “pip” </span></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></div><div><a href="http://www.pip-installer.org/en/latest/index.html"><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">http://www.pip-installer.org/en/latest/index.html</span></a></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">In essence, pip is a python package installer</span></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></div><div><b><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Things pip can do</span></b></div><div><ul><li><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Manage python packages much like apt-get manages system packages</span>
<br /></li><li><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Automatically build C-extensions as required</span>
<br /></li><li><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Automatically upgrade/downgrade packages based on your specs</span></li>
<br /></ul></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Here’s a quick cheatsheet to the commands we most commonly use</span></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></div><div><b><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Enumerating installed packages</span></b></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></div><div><i><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">$ pip freeze</span></i></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></div><div><b><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Uninstalling packages</span></b></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></div><div><i><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">$ sudo pip uninstall Django</span></i></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></div><div><b><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Installation - By name and version</span></b></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="white-space: pre;"><i>$ </i></span><i>sudo pip install Django==1.2.5 pycrypto==2.0.1 simplejson==2.1.5</i></span></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></div><div><b><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Installation - From a requirements file</span></b></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">A requirements file is a text file that literally looks like the following. This makes it trivial to version control what python packages/versions we have running in our production systems.</span></div><blockquote><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Django==1.2.5</span></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">pycrypto==2.0.1</span></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">simplejson==2.1.5</span></div><div></div></blockquote><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="white-space: pre;"><i>$ </i></span><i>sudo pip install -r my-requirements.txt</i></span></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br />We found "pip" to be VERY fast at enumerating already installed packages. To see this for yourself, re-run the above command! We currently have about 35 packages in production and </span><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">"pip"</span><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;"> can enumerate all of these in about half a second.
<br /></span></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></div><div><b><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Installation - Using a private PyPi server</span></b></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">All commands thus far have managed to magically discover these packages/versions versions and install them on our behalf. Behind the scenes, "pip" installs from PyPi, a public HTTP server that has meta-information regarding all these packages. You can think of PyPi as the closest thing Python has to a central package repository. Most of the time, we can rely on PyPi being up. To isolate yourself from the occasional PyPi hiccup though, you can setup your own private PyPi server. To install packages using your own private server, run
<br /></span></div><div>
<br /><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="white-space: pre;"><i>$ </i></span><i>sudo pip install [-r my-requirements.txt</i><name-of-requirements-file><i>] [package==version] --index-url http://your-pypi-server</i><your-private-pypi-server><url-of-your-private-pypi-server><i>:8001/simple</i></url-of-your-private-pypi-server></your-private-pypi-server></name-of-requirements-file></span></div><div><name-of-requirements-file><your-private-pypi-server><url-of-your-private-pypi-server><i><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></i></url-of-your-private-pypi-server></your-private-pypi-server></name-of-requirements-file></div></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Setting up your own private PyPi server has some benefits, you can</span></div><div><ul><li><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Isolate yourself from PyPi going down</span>
<br /></li><li><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Download all packages over a local network connection (Speedy!)</span>
<br /></li><li><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Manage custom-modified packages and have them install as part of the standard requirements process - for example, if you needed to hack Tornado</span></li></ul></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">Setting up a private PyPi server is a bit beyond the scope of this article but here’s an article that definitely helped us on our way</span></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></div><div><a href="http://brandonkonkle.com/blog/2010/mar/25/creating-personal-pypi-chishop/"><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">http://brandonkonkle.com/blog/2010/mar/25/creating-personal-pypi-chishop/</span></a></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br /></span></div><div><span class="Apple-style-span" style="font-family:Arial, Helvetica, sans-serif;">
<br />Thanks to “pip” we’ve managed to tame our package installation process. Hopefully, after reading this article you will have too :)</span></div>Anonymousnoreply@blogger.com117tag:blogger.com,1999:blog-5747208419659906777.post-982415121577053952011-08-11T18:51:00.000-07:002011-08-16T18:09:18.321-07:00Hardly working hard<div id="contents" style="margin-top: 6px; margin-right: 6px; margin-bottom: 6px; margin-left: 6px; "><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>I am lazy. I don’t remember when it began, but to the great frustration of my mother, it has yet to end. Luckily though, there are many tools available for the lazy software engineer, some of which I’d like to share today in this post.</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c8" style="font-weight: bold; ">Too lazy to type?</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span class="c8" style="font-weight: bold; "></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>I like saving key strokes. Why type when you can...not type? There are a couple of bash tricks I learned from Carlos and Jesse that I really like:</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><ol class="c13" start="1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: decimal; "><li class="c2 c10" style="padding-left: 0pt; margin-left: 36pt; direction: ltr; "><span class="c9 c0" style="background-color: rgb(153, 153, 153); font-family: Consolas; ">cd -</span><span> cd to last visited directory. Everybody knows about cd ~, but this is at least as useful. Instead of taking you home, cd - takes you to the last directory you visited.</span></li></ol><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span> Example use case:</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span> </span><span class="c0" style="font-family: Consolas; "> cd /path/to/logs</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> tail log1 | cut -f 3 | sort</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> tail log2 | cut -f 5 | sort</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> …</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> cd -</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> vim</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> </span><span> 2. </span><span class="c9 c0" style="background-color: rgb(153, 153, 153); font-family: Consolas; ">ctrl + r</span><span>: Reverse search bash history. Here at Adku, we run A LOT of map reduces. Most of the time, we’re calling the same few commands. ctrl + r lets us run, forget, and then run again later.</span></p><p class="c2 c15" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; text-indent: 36pt; "><span>Example use case:</span></p><p class="c6 c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 36pt; text-indent: 36pt; direction: ltr; "><span class="c0" style="font-family: Consolas; ">fab some_map_reduce_job:arg1=’ahhhh’,arg2=’wahhhhh’</span></p><p class="c6 c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 36pt; text-indent: 36pt; direction: ltr; "><span class="c0" style="font-family: Consolas; ">cd ../</span></p><p class="c2 c6" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 36pt; text-indent: 36pt; direction: ltr; "><span class="c0" style="font-family: Consolas; ">touch ‘asdf’</span></p><p class="c6 c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 36pt; text-indent: 36pt; direction: ltr; "><span class="c0" style="font-family: Consolas; ">…</span></p><p class="c6 c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 36pt; text-indent: 36pt; direction: ltr; "><span class="c0" style="font-family: Consolas; ">ctrl + r <ret></ret></span></p><p class="c6 c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 36pt; text-indent: 36pt; direction: ltr; "><span class="c0" style="font-family: Consolas; "> fab <right></right></span></p><p class="c6 c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 36pt; text-indent: 36pt; direction: ltr; "><span class="c0" style="font-family: Consolas; "> fab some_map_reduce_job:arg1=’ahhhh’,arg2=’wahhhhh’</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span> 3. </span><span class="c0 c9" style="background-color: rgb(153, 153, 153); font-family: Consolas; ">!n:x-y</span><span> Recall arguments </span><span class="c0" style="font-family: Consolas; ">x-y</span><span> from the last </span><span class="c0" style="font-family: Consolas; ">n</span><span>th command. This is another command that is a great help when running map reduces with complicated argument lists. Though, it is a lot more complicated than the other commands mentioned here, and worth reading about separately. True to the theme of this post, I redirect you to: </span><span class="c5" style="color: rgb(0, 0, 153); text-decoration: underline; "><a class="c11" href="http://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history/" style="text-decoration: inherit; ">http://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history/</a></span><span> for a great resource on this, and will stick to giving a few simple examples.</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span> Example use case(s):</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> >echo “foobar”</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> foobar</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> >echo “moocow”</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> moocow</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> >!-2</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> foobar</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> >!-2</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> moocow</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>--------</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> cat foo > impossible_to_remember_filename_akj3kj2437fvaj</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> nano !:3</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; ">--------</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span> </span><span class="c0" style="font-family: Consolas; ">port install haskell-platform</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> ##oh no, permission failure##</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> sudo !!</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>---------</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> >echo “hi” && echo “why”</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> hi</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> >!!:0-1</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> hi</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> >!-2:2-$</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; "> why</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c8" style="font-weight: bold; ">Too lazy to go to work?</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span class="c8" style="font-weight: bold; "></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>Being too lazy to go to work is, of course, never a problem for me. But theoretically, I could see the following scenario occur.</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>1. While at work, start a ssh tunnel between your work computer and a gateway server. (For details on how we do this, checkout: </span><span class="c5" style="color: rgb(0, 0, 153); text-decoration: underline; "><a class="c11" href="http://blog.adku.com/2011/06/working-remotely.html)" style="text-decoration: inherit; ">http://blog.adku.com/2011/06/working-remotely.html)</a></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>2. Go home, relax.</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>3. Start a ssh session to your work server.</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>4. Start tmux</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>5. never go to work again.</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>With the exception of 4 (and 5?), this is probably a familiar process. But here’s the beauty of four:</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span> </span><span class="c0" style="font-family: Consolas; ">connection closed by remote host.</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>Never again.</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>To quote the tmux man page:</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span> </span><span class="c0" style="font-family: Consolas; ">Each session is persistent and will survive accidental disconnection (such as ssh(1) connection timeout) or intentional detaching (with the `C-b d' key strokes).</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span class="c0" style="font-family: Consolas; "></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>Aside from never losing your work due to connection problems, Tmux also makes it easy to start a job at work, go home, and continue monitoring that job remotely, or vice versa.</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>For example:</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>I start a tmux session at start tailing a random log at work:</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><img height="333" src="https://docs.google.com/a/adku.com/document/pubimage?id=1lq8XF1WGMiDlMix0D00Mws-cYqsZg-1_ClVJZZw6lUE&image_id=1Vl3BtqNbIc7_Z8LrWS39vLJ-w8SgwNA" width="534" /></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>To remember this session, I name it by typing</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c0" style="font-family: Consolas; ">ctrl + b + : rename_session “foo”</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span class="c0" style="font-family: Consolas; "></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>Then I go home.</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>At home, I ssh into my work computer and type</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><img height="204" src="https://docs.google.com/a/adku.com/document/pubimage?id=1lq8XF1WGMiDlMix0D00Mws-cYqsZg-1_ClVJZZw6lUE&image_id=1msuRzgE5gY0OFHn-_Gzg37orqVTW4kE" width="613" /></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>and everything just works!</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><img height="219" src="https://docs.google.com/a/adku.com/document/pubimage?id=1lq8XF1WGMiDlMix0D00Mws-cYqsZg-1_ClVJZZw6lUE&image_id=19env3o-keDY2_xfqKvi_AOku7rnoTFo" width="663" /></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span> </span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>In addition to creating and naming sessions, tmux makes it easy to create and name panes within sessions. I often find myself running many jobs of the same type, which I like to organize into named panes within a single session.</span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><img height="238" src="https://docs.google.com/a/adku.com/document/pubimage?id=1lq8XF1WGMiDlMix0D00Mws-cYqsZg-1_ClVJZZw6lUE&image_id=1nlmybV7v7o8s0BuSrEMIlsn-08e0v88" width="526" /></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>The panes I have open are called “mo”, “meeny”, and “eeny”. In each screen I am running a different map reduce job. By naming the panes, I’ll remember exactly what I was running in each pane wherever I go.</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span>Basic panel usage:</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><table cellpadding="0" cellspacing="0" class="c7" style="border-collapse: collapse; "><tbody><tr><td class="c3" style="vertical-align: top; width: 234pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; padding-top: 5pt; padding-right: 5pt; padding-bottom: 5pt; padding-left: 5pt; "><p class="c2 c4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; line-height: 1; "><span>create</span></p></td><td class="c3" style="vertical-align: top; width: 234pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; padding-top: 5pt; padding-right: 5pt; padding-bottom: 5pt; padding-left: 5pt; "><p class="c2 c4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; line-height: 1; "><span class="c0" style="font-family: Consolas; ">ctrl + b c</span></p></td></tr><tr><td class="c3" style="vertical-align: top; width: 234pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; padding-top: 5pt; padding-right: 5pt; padding-bottom: 5pt; padding-left: 5pt; "><p class="c2 c4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; line-height: 1; "><span>delete</span></p></td><td class="c3" style="vertical-align: top; width: 234pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; padding-top: 5pt; padding-right: 5pt; padding-bottom: 5pt; padding-left: 5pt; "><p class="c2 c4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; line-height: 1; "><span class="c0" style="font-family: Consolas; ">ctrl + b x</span></p></td></tr><tr><td class="c3" style="vertical-align: top; width: 234pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; padding-top: 5pt; padding-right: 5pt; padding-bottom: 5pt; padding-left: 5pt; "><p class="c2 c4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; line-height: 1; "><span>rename</span></p></td><td class="c3" style="vertical-align: top; width: 234pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; padding-top: 5pt; padding-right: 5pt; padding-bottom: 5pt; padding-left: 5pt; "><p class="c2 c4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; line-height: 1; "><span class="c0" style="font-family: Consolas; ">ctrl + b ,</span></p></td></tr><tr><td class="c3" style="vertical-align: top; width: 234pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; padding-top: 5pt; padding-right: 5pt; padding-bottom: 5pt; padding-left: 5pt; "><p class="c2 c4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; line-height: 1; "><span>navigate to previous panel</span></p></td><td class="c3" style="vertical-align: top; width: 234pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; padding-top: 5pt; padding-right: 5pt; padding-bottom: 5pt; padding-left: 5pt; "><p class="c2 c4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; line-height: 1; "><span class="c0" style="font-family: Consolas; ">ctrl + b p</span></p></td></tr><tr><td class="c3" style="vertical-align: top; width: 234pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; padding-top: 5pt; padding-right: 5pt; padding-bottom: 5pt; padding-left: 5pt; "><p class="c2 c4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; line-height: 1; "><span>nagivate to next panel</span></p></td><td class="c3" style="vertical-align: top; width: 234pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; padding-top: 5pt; padding-right: 5pt; padding-bottom: 5pt; padding-left: 5pt; "><p class="c2 c4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; line-height: 1; "><span class="c0" style="font-family: Consolas; ">ctrl + b n</span></p></td></tr><tr><td class="c3" style="vertical-align: top; width: 234pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; padding-top: 5pt; padding-right: 5pt; padding-bottom: 5pt; padding-left: 5pt; "><p class="c2 c4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; line-height: 1; "><span>navigate to panel #</span></p></td><td class="c3" style="vertical-align: top; width: 234pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; padding-top: 5pt; padding-right: 5pt; padding-bottom: 5pt; padding-left: 5pt; "><p class="c2 c4" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; line-height: 1; "><span class="c0" style="font-family: Consolas; ">ctrl + b #</span></p></td></tr></tbody></table><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; "><span class="c8" style="font-weight: bold; ">Too lazy to...continue?</span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 11pt; direction: ltr; "><span></span></p><p class="c2 c12" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; direction: ltr; text-align: center; "><img height="256" src="https://docs.google.com/a/adku.com/document/pubimage?id=1lq8XF1WGMiDlMix0D00Mws-cYqsZg-1_ClVJZZw6lUE&image_id=1jyUAbX8BFzKHc-9rBTusmfSSvmlJHP4" width="339" /></p></div>Anonymousnoreply@blogger.com38tag:blogger.com,1999:blog-5747208419659906777.post-85480126546156175192011-07-25T14:38:00.000-07:002011-07-26T18:48:55.450-07:00Working with Git - Part 1 - Our initial experience<span style="font-size:100%;"><span style="font-family:arial;">When Adku first opened shop, we used Subversion for source control. Since then, we’ve migrated over to the wonderful world of Git and wanted to share why we moved and some aha moments we’ve experienced along the way.</span><br /><br /><span style="font-family:arial;">Why we moved to Git</span><br /></span><ol style="font-family:arial;"><li><span style="font-size:100%;">Speedy commits and updates, subversion commits got to be painfully slow - sometimes taking minutes</span></li><li><span style="font-size:100%;">Cheap local branching</span></li><li><span style="font-size:100%;">Better merging. e.g. merges follow renames and code moves</span></li><li><span style="font-size:100%;">Better support for file renames and file permission changes</span></li><li><span style="font-size:100%;">Interactive commits or the ability to commit partial files</span></li></ol><span style="font-size:100%;"><br /><span style="font-family:arial;">Our aha moments</span><br /></span><ol style="font-family:arial;"><li><span style="font-size:100%;">A “commit” is essentially a diff with a pointer pointing to the commit we created a diff from</span></li><li><span style="font-size:100%;">A “branch” is a pointer that can be updated to point to any commit</span></li><li><span style="font-size:100%;">Deleting a “branch” is akin to deleting the pointer to that commit, if you have another “branch” (pointer) pointing to that commit, your changeset will NOT disappear</span></li><li><span style="font-size:100%;">A “remote” is a reference to a clone of this repository. This clone is usually hosted on another machine but it can also be another repository on your own hard drive.</span></li><li><span style="font-size:100%;">“git pull” is effectively the same thing as a “git fetch && git merge”</span></li><li><span style="font-size:100%;">“git fetch” is safe to re-run and does NOT update any files in your branch. It updates your knowledge of where the “remote” repository thinks it is.</span></li><li><span style="font-size:100%;">“git rebase origin/master” works by uncommiting all your commits in reverse order, updating your branch to origin/master, then replays your commits in order</span></li><li><span style="font-size:100%;">Your repository will continue to think a branch exists on a “remote” repository even if it was deleted by another developer. To remove branches that don’t actually exist on the “remote” anymore, you can run “git fetch --prune”</span></li></ol><span style="font-size:100%;"><br /><span style="font-family:arial;">At the end of the day, we realized that these insights did not come cheaply. We invested a lot of time trying to understand Git and we recognized that we could not afford to have every new hire spending weeks getting up to speed on a version control system. </span><br /><br /><span style="font-family:arial;">We ultimately decided to write bash scripts for the most common developer actions to help encapsulate all our Git knowledge and best practices. The culmination of that project is a development model we’re calling Dr. Git (Develop/Release with Git) which we’re excited to share in a following blog post.</span></span>Anonymousnoreply@blogger.com42tag:blogger.com,1999:blog-5747208419659906777.post-86779663315802166102011-07-19T13:44:00.000-07:002011-07-19T18:10:07.291-07:00Redmine<div>There are so many issue tracking tools available today with so many features, it was hard to figure out which one was best for us. We looked at JIRA, Trac, FogBugz, Plan.io and a few others, but in the end, we ended up choosing <a href="http://www.redmine.org/" style="color: #0000cc;" target="_blank">Redmine</a> and hosting it ourselves. </div><div><br />
</div><div>For our specific usage patterns, we had some very specific features that we wanted in an issue tracker. Things like road map planning tools, searching, and UI were pretty pervasive, but there were a couple that we had trouble finding out of the box.</div><div><ul><li style="margin-left: 15px;">Tight email integration</li>
<ul><li style="margin-left: 15px;">We wanted to be able to reply-all to an email and add the issue tracker to create a new issue with the thread in the description.</li>
<ul><li style="margin-left: 15px;">Subsequent emails to the same gmail thread would then be automatically added to the issue.</li>
</ul><li style="margin-left: 15px;">We wanted to be able to modify issues directly from email using special syntax like "assignee: jesse" or "status: in progress".</li>
</ul><li style="margin-left: 15px;">Github integration</li>
<ul><li style="margin-left: 15px;">We wanted to be able to attach git commits to issues using special syntax in the commit message like "closes #12".</li>
<li style="margin-left: 15px;">We didn't want to migrate our repository off of Github.</li>
</ul></ul><div><br />
</div><div>A lot of issue trackers do have email integration, but with one slight quirk. If you reply-all and add the issue tracker, it creates a new issue. If someone else then replies to the thread, a brand new issue gets created! We wanted the issue tracker to be intelligent enough to realize that it was the same issue and update it instead of creating a new one. Redmine didn't do this out of the box, but because it's open source, we edited a few lines and got it to work the way we wanted in a little less than 5 minutes. This may seem like a small, subtle issue, but it's one that we now make use of many times each day so the impact is significant in our daily usage pattern.</div></div><div><br />
</div><div>A lot of issue trackers integrate well with source control, but they require you to host your repository with the issue tracker! This means that we'd either have to move our repo off of Github or we'd have to setup processes to push our code to two repositories. Pushing to two repositories sounded like a potential nightmare and few issue trackers allow you to integrate with an external repository like Github. What we ended up doing was syncing our Redmine repository directly from Github using a cronjob. Post-commit hooks would have been better, but we left that as a TODO since it would require more than 5 minutes to setup and the cronjob was sufficient for the job.</div><div><br />
</div><div>Redmine's got some great plugins too. We use <a href="http://www.redminebacklogs.net/" style="color: #0000cc;" target="_blank">the backlogs plugins</a> for a great drag-n-drop UI and burndown charts. </div><div><br />
</div><div>Given that we've already made two edits to the issue tracker, we felt great peace of mind choosing an issue tracker that was open source and self-hosted so we can modify it to suit our needs whatever they may be. Oh and also, it's free =).</div><div><br />
</div>Jesse Shiehhttp://www.blogger.com/profile/02370410110943148171noreply@blogger.com39tag:blogger.com,1999:blog-5747208419659906777.post-70933610594456920382011-06-15T14:43:00.000-07:002011-06-16T11:59:38.500-07:00Working Remotely<span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;">At Adku, every engineer we hire gets a quad-core iMac with a 12GB memory upgrade and a 15-inch quad-core MacBook Pro with maximum memory upgrades (8GB). When we're working remotely on our laptops, sometimes we'll realize that we forgot to check-in a piece of code that is sitting on our iMac at work. If we could ssh into the iMac, we'd be able to check it in and continue where we left off. The problem is our office is behind multiple NATs which make it hard to set up port forwarding and as a fast moving startup, it's not worth the time to set up our own name server. We needed something quick and easy. What we ended up doing was setting up SSH tunnels from our machines at work to an Amazon EC2 instance we call <a href="http://gateway.adku.com/" target="_blank">gateway.adku.com</a>. With the tunnel set up, accessing our machines at work is as simple as SSH'ing to the right port on <a href="http://gateway.adku.com/" target="_blank">gateway.adku.com</a>. Here is how to set one up for yourself.</span><br />
<div><ol></ol></div><br />
<div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><b>On Work Machine:</b></span><br />
<div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><i># create security group and authorized ports</i></span></div><div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><i># this assumes that you have an amazon ec2 account and </i></span><br />
<span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><i># ami-tools and api-tools setup. </i></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><i># setting all that up is straightforward, but outside the scope of this post</i></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;">ec2-add-group --region us-east-1 gateway -d gateway</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;">ec2-authorize --region us-east-1 -p 22 gateway</span><br />
<div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><br />
</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><i># create your gateway machine.</i></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><i># your ami may differ. ubuntu likes to update its amis very often. </i></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><i># also your keypair may have a different name, adjust accordingly</i></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;">ec2-run-instances ami-ee857587 --instance-type m1.small --region us-east-1 -k gsg-keypair-east -g gateway</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><br />
</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><i># note the public url of the newly created machine</i></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><i># also optionally setup an easier DNS name such as <a href="http://gateway.adku.com/" target="_blank">gateway.adku.com</a></i></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><br />
</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><b>On Gateway Machine:</b></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;">sudo echo "GatewayPorts yes" >> /etc/ssh/sshd_config</span></div><div class="im"><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;">sudo /etc/init.d/ssh reload</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><br />
</span></div></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><b>On Work Machine:</b></span><br />
<span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><i># 20000 is an arbitrary port, you can choose any open port. </i></span><br />
<span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><i># you just have to remember it for later.</i></span></div></div></div><div><div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><i># gateway.adku.com should also be replaced with your public dns name</i></span></div></div></div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;">ec2-authorize --region us-east-1 -p 20000 gateway</span><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"></span><br />
<div><div><div class="im"><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><span style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;">ssh -nNT -R gateway.adku.com:20000:<wbr></wbr>localhost:22 <a href="http://gateway.adku.com/" target="_blank">gateway.adku.com</a></span></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><br />
</span></div></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;">And you're done! </span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><br />
</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;">Now you can get to your work machine from anywhere like this:</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><br />
</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><b>On Any Machine:</b></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><i># 20000 is the port from earlier, make sure it matches</i></span></div><div class="im"><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><span style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;">ssh -p 20000 <a href="mailto:jesse@gateway.adku.com" target="_blank">jesse@gateway.adku.com</a></span></span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><br />
</span></div></div></div></div></div>Jesse Shiehhttp://www.blogger.com/profile/02370410110943148171noreply@blogger.com43tag:blogger.com,1999:blog-5747208419659906777.post-55276094856045316902011-05-27T10:04:00.000-07:002011-07-25T14:43:09.472-07:00Giving back - Extending MRJobIf you’ve ever used MRJob to run a MapReduce and wanted to debug a problem, you’ll soon realize that attaching a debugger to your mappers and reducers is very difficult. We’ve solved this by building a local, inline job runner that makes it as easy to debug your MapReduce as if it were a standalone Python script.<br /><br />Over the last few weeks, Adku has been playing around with a cool new project named MRJob, a python package that streamlines the development of MapReduce jobs. One of the core features of MRJob is that you can write your MapReduce job once (in Python!) and run it pretty much anywhere. Out of the box, MRJob comes with support for launching your jobs onto a Hadoop cluster. It also comes with built-in support for launching jobs directly on Amazon's ElasticMapReduce (EMR) service. Why is this exciting you ask? Well, Amazon makes it simple to launch arbitrarily large/small Hadoop clusters in a matter of minutes. If you need a tiny cluster to test that your job works remotely, you can run your cluster on a single “m1.small” instance. If you need a huge Hadoop cluster to crunch gigabytes or even terabytes worth of data, you can spin up a cluster with dozens of “m1.large” instances.<br /><br />Before spinning up hundreds of machines to run your mind-blowing MapReduce job, you'll probably want to test that your job works before blowing through your IT budget. Nothing sucks more than spinning up a huge cluster, waiting for Amazon to provision all your machines, then find out that you had a typo in your job. Because Amazon rounds up on instance-hours used, your 5 minute jaunt to nowhere just cost you “$/instance-hour * # of instances * 1 hour” Luckily, MRJob provides ways for you to test your job before launching on EMR.<br /><br />Out of the box, MRJob comes with support for a local job runner that acts like a mini-Hadoop cluster with a single mapper and a single reducer. The local runner works by first trying to emulate the environment you would see in Hadoop. Then it tries to run the equivalent of “python mapper -> sorter -> python reducer” Because the local job runner tries to clone the remote environment, this is for testing that you’ve uploaded all job dependencies. The local job runner tries to emulate Hadoop even more by using pipes to Hadoop streaming. Unfortunately, because the local job runner works by spinning up subprocesses, your favorite debugger will not be able to attach to your map/reduce phases.<br /><br />Over the last few weeks, we've struggled with debugging our local MapReduce jobs. Raising exceptions in the map/reduce phases feels gross. Emitting counters with entire error messages felt even worse. If you’ve ever tried to debug a mapreduce job in a debugger or an IDE, you’ll know how difficult it is to get something as simple as a traceback. Really, what we want do is attach a debugger to our map/reduce phase to see exactly what was going on. After some poking and prodding at MRJob's internals, we figured out a way to run mappers and reducers in the same process as the launcher script. By running your job with “--runner inline” you can now attach a debugger to your job and observe pretty much everything! “--runner inline” is designed to be used in conjunction with “--runner local” It is not meant to replace the default run mode (local) as we do NOT faithfully replicate the file system you would see in Hadoop. This runner is purely for development/debugging purposes.<br /><br />Where can you get this patch you ask? Well, we love giving back to the community so we sent our patch upstream a few days ago. Today, I’m happy to report that the maintainers over at Yelp accepted our changeset and has released as a part of mrjob 0.2.6!<br /><br />PyPi registration - <a href="http://pypi.python.org/pypi/mrjob">http://pypi.python.org/pypi/mrjob</a><br /><br />Homepage -<a href="https://github.com/Yelp/mrjob"> https://github.com/Yelp/mrjob</a><br />Documentation -<a href="http://packages.python.org/mrjob/"> http://packages.python.org/mrjob/</a><br /><br />-MattAnonymousnoreply@blogger.com338tag:blogger.com,1999:blog-5747208419659906777.post-87257175318446472942011-05-16T17:28:00.000-07:002011-05-28T10:19:09.955-07:00We’ve moved into new offices!<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: Times; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"></span><br /><div style="background-color: transparent;"><span id="internal-source-marker_0.724022775888443" style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">It's been really busy over the last few months, while we've </span><span id="internal-source-marker_0.724022775888443" style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">been building our product and company, </span><span id="internal-source-marker_0.724022775888443" style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">and we haven’t had much time to come up for air. We've got one piece of fun news that we'd like to share - we just moved into our new office! As we've expanded the team, we could no longer fit into our previous space which was graciously provided by our friends at </span><a href="http://pivotallabs.com/"><span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Pivotal Labs</span></a><span style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. </span><br /><span style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">We’re based in the heart of the tech center of San Francisco in SoMa at 300 Beale St close to great technology startups and software giants as well as great restaurants and public transportation. </span><br /><span style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">We looked at quite a few different spaces and really wanted something unique and creative and, after a lot of looking, we found the perfect place for us. For those who’ve been around San Francisco for a while, this space used to be occupied Elroy’s which incidentally happened to be one of the first restaurants I ever ate at when I moved to the Bay Area.</span><br /><span style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If you’re in the area, please stop by and say hello! We’ve got a lot of plans for the office and I’ve posted some pictures of how the space looks in the raw. If you have ideas on how we should decorate, just let us know in the comments. </span><br /><span style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">This is just another step in our journey as a startup and we’re really excited to share it with you. </span></div><div style="background-color: transparent;"><span style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div><div class="separator" style="clear: both; text-align: center;"></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><img height="300" id="internal-source-marker_0.724022775888443" src="https://lh4.googleusercontent.com/gO7-ZMWr8xVx06cNvc0jj1DIwlAVr6TRCliHFzY9Lgm0mXCFps6lchxiPdlmS1X-UA7cyCYOH4i7pitc8WGv6gXpeNQsxd2eImt0Ywg-lpeeYmuLV3o" style="margin-left: auto; margin-right: auto;" width="400" /></td></tr><tr><td class="tr-caption" style="text-align: center;">Entrance</td><td class="tr-caption" style="text-align: center;"> </td><td class="tr-caption" style="text-align: center;"> </td><td class="tr-caption" style="text-align: center;"> </td></tr></tbody></table><br /><div style="background-color: transparent;"><table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><img height="300" id="internal-source-marker_0.724022775888443" src="https://lh5.googleusercontent.com/fNjM1gyVKHSFYNR9mF-DcmVQNFtrRCzguVhfegJKjWd-orhidBnRt2-bFoNgaTcQbhWzDUzgWQRLfHyenPS8dmz9qgf84BM0GprsOzZHMVsHkvER0ws" style="margin-left: auto; margin-right: auto;" width="400" /></td></tr><tr><td class="tr-caption" style="text-align: center;"><div style="background-color: transparent;">Bottom floor looking up at the mezzanine</div><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: Times; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><div style="background-color: transparent;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: Times; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"></span><span id="internal-source-marker_0.724022775888443" style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div><div style="background-color: transparent;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: Times; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"></span><span id="internal-source-marker_0.724022775888443" style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div><div style="background-color: transparent;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: Times; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"></span></div></span></td></tr></tbody></table><span style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div><div style="background-color: transparent;"><span style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><img height="300" id="internal-source-marker_0.724022775888443" src="https://lh5.googleusercontent.com/HSwL4xOP5ZNtzscNG9ufzksXFgoqM2b6XLqRc72HfKdjr2mYY5jO6fYdsfl_wju0t6iKMOLDei4Lnckeg6m8y-TZxBJpTJQgO8lEJJtvVng59qPw4qw" style="margin-left: auto; margin-right: auto;" width="400" /></td></tr><tr><td class="tr-caption" style="text-align: center;">Front conference/game room</td></tr></tbody></table><br /><span style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div><div style="background-color: transparent;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: Times; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><img height="300" id="internal-source-marker_0.724022775888443" src="https://lh3.googleusercontent.com/-gb_WNpqrFAnsG0JC6BXqO1p66hbNfbp-siKFM9bljjw_luyllCXnkcrdp1N6CBoT_UU5lyevTiUD9Z4rJWEYtxRpqTMsEQyo5_ix_d5SCxwszga1m8" style="margin-left: auto; margin-right: auto;" width="400" /></td></tr><tr><td class="tr-caption" style="text-align: center;">Back conference room</td></tr></tbody></table></span><span style="background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: Times; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><img height="298" id="internal-source-marker_0.724022775888443" src="https://lh3.googleusercontent.com/29ItDjl52NNaOmVvxWgoD_xiSarmX0kz3qgtQD4oCV3YGe5DovJ6pTe0crvdif600FKg1gzi8bnQWHSR9zQNhNrqMVJZOMKPQS7p4EIdK61ka2gie_Y" style="margin-left: auto; margin-right: auto;" width="400" /></td></tr><tr><td class="tr-caption" style="text-align: center;">Future break room and bike racks</td></tr></tbody></table><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><img height="300" id="internal-source-marker_0.724022775888443" src="https://lh6.googleusercontent.com/sPy2wymYD5P5p6P2NJoUWtu-uTkJ9qdMICfoWOwmbCxw-McOCjgvPVj_7AwRk91ty5RW6dcCe5K1Shws-P9mmYJACN__HxqInXo3--q0jN9bCSGFVf4" style="margin-left: auto; margin-right: auto;" width="400" /></td></tr><tr><td class="tr-caption" style="text-align: center;">Top floor looking down.</td></tr></tbody></table></span><br /><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: Times; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"></span></div>Ajit Varmahttp://www.blogger.com/profile/15774628543200631695noreply@blogger.com39tag:blogger.com,1999:blog-5747208419659906777.post-72946409605409846742011-02-08T22:54:00.000-08:002011-03-13T10:24:48.862-07:00Startup Interviews<div>I spent almost 6 years at Google interviewing nearly 300 potential Googlers. That inteviewing career started with an interviewing class and some shadowing of fellow engineers before diving in solo. At Google I focused my interview on trying to figure out if the person I was interviewing would have a good shot at being successful at Google. My requirements for Google success changed a bit over time but in general I looked for:</div><div><ol><li>Raw problem solving ability. I generally checked this by asking basically a math/problem solving question disguised as a coding question. It usually required almost no knowledge of any coding beyond what someone might learn in the first few months of coding.</li>
<li>Ability to quickly see multiple solutions, weigh them, verbalize them, and select the most appropriate given the conditions that I've put forth. I'm constantly surprised at how rarely applicants verbalize the different options for solutions to a problem, outline the pros and cons of the solutions and then proceed.</li>
<li>A substantial level of curiosity for anything they have spent time on. "If architectural decisions were made before you joined the team or without you, did you figure out why they were made, how would you have done things differently?", "How much time do you spend looking at library source files to really understand the technology you are using?", etc.</li>
<li>Communication skills. This one is a bit trite but must be mentioned as it is as important as the others listed here. During an interview, the candidate's ability to articulate their thinking process, their background, and their goals is key.</li>
<li>Ability to contribute to overall team happiness. If you are going to spend over 60% of your waking life during the week working, hopefully you enjoy what you are doing and who you are working with. When someone adds to that enjoyment, the result is a happy team, and happy teams are generally more productive, more communicative, and in the end, more successful.</li>
</ol></div><div>At Adku am I looking for anything different? I'm looking for every one of those qualities and more. The more:</div><div><ol><li>A self starter/entrepreneur personality. "Do you have side projects that you've worked on outside of school/work?", "Have you thought about starting your own company, why didn't you?" I believe the best hires for a startup are entrepreneurs or almost-entrepreneurs.</li>
<li>A coding fearlessness of the unknown. A startup generally won't have an entire team devoted to just one slice of the entire stack. Because of this, it is likely that anyone hired will have to dive into any part of the stack and be extremely productive. If the person can't pick up a new language and/or technology and get a Hello World working within hours, then they are likely the wrong person.</li>
<li>A level of self awareness and honesty. Being a part of a startup is a wild and amazing ride. Efficiency is built not only on the ability to code and <a href="http://blog.adku.com/2011/01/code-reviews.html">code review</a> quickly, but on the ability to recognize issues and course correct as fast as possible. Being successful is based on many things, including your ability to be <a href="http://blog.adku.com/2011/01/peer-reviews-in-4-month-old-3-person.html">honest</a> about your mistakes. Accessing this in an interview is difficult and subtle, but it can be done. Applicants, shouldn't "gloss" over details that you are unfamiliar with in the hopes that the interviewer won't realize that you don't have a deep understanding; admit what you understand and what you don't.</li>
<li>Product strategy/tech business curiosity. Product discussion is a very good thing and having every member of the team engaged is that discussion is important. The ability to have a healthy discourse on product/company strategy, both from business and technical point of views, is key.</li>
</ol></div><div>Does this sound like you? If so, we'd love to <a href="http://www.adku.com/jobs">talk</a> to you!</div><div><br />
</div>Carlos Whitthttp://www.blogger.com/profile/14952553628432595368noreply@blogger.com48tag:blogger.com,1999:blog-5747208419659906777.post-17584121256519583932011-02-02T09:16:00.000-08:002011-02-02T13:54:34.693-08:00HBase vs Cassandra<div><span class="blsp-spelling-error" id="SPELLING_ERROR_0">Adku</span> recently decided to migrate part of it's data to a <span class="blsp-spelling-error" id="SPELLING_ERROR_1">NoSQL</span> database in order to deal with increasing load on our MySQL database. We evaluated many options including <span class="blsp-spelling-error" id="SPELLING_ERROR_2">MongoDB</span>, Amazon <span class="blsp-spelling-error" id="SPELLING_ERROR_3">SimpleDB</span>, and a few others, but ultimately narrowed the options to just Cassandra and <span class="blsp-spelling-error" id="SPELLING_ERROR_4">HBase</span>. We experimented with both databases and evaluated them more deeply and ultimately decided to use Cassandra. This post explains the high level reasons why we chose Cassandra. </div><div><br /></div><div>Disclaimer: While these decisions apply to <span class="blsp-spelling-error" id="SPELLING_ERROR_5">Adku</span>, they might not apply to your situation. Always do your own investigation and experimentation before choosing any large part of your system. </div><div><ol><li>Reliability<br />- We wrote a stress test tool to simulate how the databases would behave under high load. We used the default minimalistic configuration for each database following their respective documentations. Our stress test inserted 1 million rows of the full "Alice in Wonderland" text (~180<span class="blsp-spelling-error" id="SPELLING_ERROR_6">kb</span>) inserted into each row done continuously with one concurrent thread into a 3 node cluster. Surprisingly, the <span class="blsp-spelling-error" id="SPELLING_ERROR_7">HBase</span> region servers actually crashed on us consistently. Cassandra never crashed once. Although we would obviously scale the cluster under high loads and crashing nodes, this is still definitely concerning and a large win for Cassandra. <br /><br /></li><li>Performance<br />- We also wrote a simulation tool to test a more realistic scenario to see how each database would respond. Similar to the above, our tool inserted 1 million rows with 2000 characters of <span class="blsp-spelling-error" id="SPELLING_ERROR_8">ascii</span> text inserted into each row done <span class="blsp-spelling-corrected" id="SPELLING_ERROR_9">continuously</span> with one concurrent thread into a 3 node cluster. <span class="blsp-spelling-error" id="SPELLING_ERROR_10">HBase</span> averaged 507 microseconds per write where Cassandra averaged 480 microseconds per write. We interpreted this as basically equivalent performance so there was no real winner here.<br /><br /></li><li>Consistency<br />- Consistency is not a hard requirement for our specific use case so Cassandra's eventual consistency model is fine for us. If we do end up needing consistency, Cassandra can support it using their configurable CAP model, we would just have to take a performance hit. <span class="blsp-spelling-error" id="SPELLING_ERROR_11">HBase</span> has consistency so it is technically the winner here, but since it's not a hard requirement for us, it doesn't carry much weight.<br /><br /></li><li>Single Point of Failure<br />- Hadoop's namenode which HBase depends on is a single point of failure. This means that if the namenode goes down, the entire database is unreachable. All Cassandra nodes are identical so there is no single point of failure. This is a win for Cassandra.<br /><br /></li><li>Hot Spot Problem<br />- Our relevant row keys are currently all timestamps. <span class="blsp-spelling-error" id="SPELLING_ERROR_15">HBase</span> chooses the node to store data on by row key in sorted order. Cassandra by default stores them on a random node in random order. This means that <span class="blsp-spelling-error" id="SPELLING_ERROR_16">HBase</span> will fall into a <span class="blsp-spelling-error" id="SPELLING_ERROR_17">hotspot</span> problem where one node is handling most of the write traffic. Cassandra, however, distributes the load across all nodes evenly. This is a win for Cassandra.<br /><br /></li><li><span class="blsp-spelling-error" id="SPELLING_ERROR_18">MapReduce</span><br />- <span class="blsp-spelling-error" id="SPELLING_ERROR_19">HBase</span> is built on top of <span class="blsp-spelling-error" id="SPELLING_ERROR_20">HDFS</span> and <span class="blsp-spelling-error" id="SPELLING_ERROR_21">Hadoop</span>. This means that <span class="blsp-spelling-error" id="SPELLING_ERROR_22">MapReduce</span> is very easy. Cassandra supports <span class="blsp-spelling-error" id="SPELLING_ERROR_23">MapReduce</span>, but doesn't support streaming <span class="blsp-spelling-error" id="SPELLING_ERROR_24">MapReduce</span> so you have to write them in Java. I'm also not sure what the relative performance is. Cassandra supports data locality so that <span class="blsp-spelling-error" id="SPELLING_ERROR_25">MapReduces</span> tasks end up processing data on the same machine as the <span class="blsp-spelling-error" id="SPELLING_ERROR_26">MapReduce</span> task so it's possible that performance is comparable, but I haven't done adequate tests. <span class="blsp-spelling-error" id="SPELLING_ERROR_27">HBase</span> is the winner here, but so far we haven't seen any drawbacks to running <span class="blsp-spelling-error" id="SPELLING_ERROR_28">MapReduce</span> on Cassandra (besides having to write in Java).<br /><br /></li><li>Simpler, Hackable<br />- Cassandra is a simpler implementation and much easier to hack. This is the same reason why we chose Tornado instead of Apache as our web server and we've actually made quite a few modifications to the Tornado web server as a result. Bugs are also much easier to debug. <span class="blsp-spelling-error" id="SPELLING_ERROR_29">HBase</span> by comparison is much more complicated and harder to debug and hack. This is a win for Cassandra and we've even already submitted patches back into open source Cassandra.<br /><br /></li><li>Community Support<br />- As of today, there are 175 users in the #<span class="blsp-spelling-error" id="SPELLING_ERROR_30">cassandra</span> channel on irc.freenode.net. <span class="blsp-spelling-error" id="SPELLING_ERROR_31">HBase</span> by comparison only has 74. Aside from <span class="blsp-spelling-error" id="SPELLING_ERROR_32">IRC</span>, it does appear that the Cassandra community is larger and more helpful than <span class="blsp-spelling-error" id="SPELLING_ERROR_33">HBase</span>. Another win for Cassandra.</li></ol></div><div><br /></div>Jesse Shiehhttp://www.blogger.com/profile/02370410110943148171noreply@blogger.com257tag:blogger.com,1999:blog-5747208419659906777.post-84051291055222788642011-01-25T20:09:00.000-08:002011-01-25T20:18:02.881-08:00Code Reviews<div>As an engineer coming from Google where every line of code is reviewed by another engineer before it is submitted, I had assumed that there would be a publicly available open source tool to help us facilitate code reviews in a similar fashion outside of the Googleplex. As it turns out, there are very few available and almost all are for doing code reviews post-commit. This includes the code review tool built into Google Code Hosting. Google Code recommends that you submit to a branch and then request a code review of the branch before merging into trunk. While that method certainly works, it's cumbersome and the overhead is too high. What inevitably ends up happening is nobody ends up requesting code reviews and the whole process gets dropped.</div><div><br /></div><div>In my experience, the only way to make sure code reviews actually happen is to enforce it in your tools. But that's a post for another day. We don't enforce code reviews here at Adku because we don't feel that code reviews should be mandatory just yet for a three person startup, but you can bet that once we get bigger, we will.</div><div><br /></div><div>Anyway, after hours of searching and experimenting with various tools, we settled on Rietveld which was developed by Guido van Rossum, author of Python and Mondrian. The problem with Rietveld, however, is that it doesn't work out of the box! It is meant to be run on appengine, but only supports Django 1.1 so you have to change your appengine setup to use Django 1.1 and this is not a trivial process. Moreover, if you run Rietveld on appengine, most of your changes will be available publicly with no way to restrict access to your internal team without diving in and modifying Rietveld source code.</div><div><br /></div><div>In the end, after a bit of troubleshooting, we successfully got Rietveld up and running and even set it up internally to restrict access.</div><div><br /></div><div>Now that it's up, it is beautiful, works great, and is exactly what we were looking for. Typical use looks something like this</div><div><ol><li>make some local edits<br />$ vi my_source_code.py</li><li>send the changes to carlos for code review<br />$ python rietveld/upload.py --send_mail -r carlos</li><li>carlos gets an email that looks like this<br />From: <codereview@adku.com><br />Date: Thu, Nov 4, 2010 at 11:19 AM<br />Subject: better demo (issue24)<br />To: carlos@adku.com<br /><br /><br />Reviewers: carlos,<br /><br />Please review this at http://rietveld:8000/24/<br /><br />Affected files:<br />...<br />...</li><li>carlos clicks on the link and sees the unsubmitted changes in a web ui with change highlighting, syntax highlighting, and an inline commenting ui</li><li>carlos enters a few comments inline with the changes and hits send</li><li>i make the changes suggested and re-send the code</li><li>he reviews again and hits approve</li><li>i submit the pending change in my local client</li></ol></div><div><br /></div>Jesse Shiehhttp://www.blogger.com/profile/02370410110943148171noreply@blogger.com49tag:blogger.com,1999:blog-5747208419659906777.post-22075713641023414462011-01-03T15:41:00.000-08:002011-01-04T08:51:07.054-08:00Peer reviews in a 4 month old, 3 person startup?<div>Even though Adku is only 4 months old, part of our company culture involves doing periodic NxN peer reviews. Everyone reviews everyone else and provides hard, candid feedback on strengths and weaknesses. But are peer reviews necessary for a 3 person startup that's only 4 months old you ask? Yes, it's critical, and I'll tell you why.</div><div><br /></div><div>Company culture is very hard to change</div><div><br /></div><div>Company culture is one of those things you need to engrain as early as you can. What you do in the beginning months of your startup will permeate through it's entire life and it's very hard to change. That's why we decided to have regular retrospective meetings to improve how we work, that's why we work on puzzles together every week, and that's why we take trips together and drink together. </div><div><br /></div><div>Conflict resolution is critical to company success</div><div><br /></div><div>The most common reason for company dissolution in the early stages is some kind of personal conflict. If the early team can not discuss issues like product direction options or annoying work habits openly and resolve them, then they are doomed to fail. I've seen this time and again. Peer reviews help make sure issues get raised, discussed, and resolved. </div><div><br /></div><div>Deep insight into team strengths will help shape team responsibilities</div><div><br /></div><div>Typically, engineering teams inside companies have managers. This is because managers add value. Don't get me wrong, there are certainly managers out there who decrease value, but in general, they exist because they can assign responsibilities intelligently and make adjustments based on team dynamics and individual strengths. Without a manager, the founding team has to do this collaboratively. Peer reviews are essential to make this happen.</div><div><br /></div><div>Each individual's personal growth creates shareholder value</div><div><br /></div><div>The output you create at your company today may be worth $500,000/year. If peer reviews end up making you more productive resulting in an increased output worth $600,000/year, then you've just increased the value of the company. To be fair, chances are you will also get a raise, but it won't be equal to your increase in output. This is because you yourself do not actually produce $600,000/year. You are leveraged by the rest of the company. An engineer at Google may output $10,000,000/year, but may only output $100,000/year at Microsoft for equivalent work.</div><div><br /></div>Jesse Shiehhttp://www.blogger.com/profile/02370410110943148171noreply@blogger.com77tag:blogger.com,1999:blog-5747208419659906777.post-34174015186042262302010-12-15T15:26:00.000-08:002010-12-16T07:13:20.891-08:00The ideal founding team<a href="http://www.adku.com/static/team-skills.png"><img src="http://www.adku.com/static/team-skills.png" width="500" /></a><br /><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;"></span><br /><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;">If you're starting a new company and wondering what your founding team should look like, you have several options.</span></div><div><ul><li><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;">The all engineering team</span></li><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;"><li>The all MBA team</li><li>The 50/50 Team</li><li>The 1:2 Team</li><li>Going Solo</li></span></ul><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;">Which option you choose is highly dependent on what you plan to build, whether or not you've started a company before, or if you even have the luxury of choosing (I think personality fit is by far the most important deciding factor, but that's for another post). </span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;"><br /></span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;">The all engineering team</span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;"><br /></span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;">Engineering should always be the focus and core competency of your team. It sounds obvious, but your company exists in order to build a good product. Great marketing and sales will get you in the door, but without great engineers, your company will wither and die. That said, an all engineering team lacks the marketing and sales that get you in the door, especially for an enterprise software company. </span></div></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;"><br /></span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;">The all MBA team</span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;"><br /></span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;">If you don't have an engineer in your founding team, your chance of success drops significantly. This is the reason why so many VCs and angels have publicly stated that they avoid investing in non-technical founding teams. </span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;"><br /></span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;">The 50/50 team</span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;"><br /></span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;">50% engineering, 50% non-engineering. Make sure that the non-engineer on the team is a product manager that can also do sales, not the other way around. Most teams that fall into this category in my experience end up with an overworked engineer and an underworked product manager, which means you'll be raising money early to hire more engineers and getting diluted at sub-optimal terms.</span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;"><br /></span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;">The 1:2 Team</span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;"><br /></span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;">2 engineers, 1 product manager. In my experience, this is by far the best combination. The work load is distributed evenly for the early stages of the company and you can quickly build a prototype and get traction in order to raise money on favorable terms. Above is a venn diagram of the ideal skills and overlap of what I think is the perfect founding team. That said, for a consumer internet company that doesn't need sales, the product manager might end up being under-worked. This worked great for my company, but we do enterprise software.</span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;"><br /></span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;">Going Solo</span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;"><br /></span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;">If you're a 3-time successful entrepreneur with VCs clamoring to give you money at astronomical valuations without an idea, then this might be an option for you. Otherwise, this option is a death sentence.</span></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small;"><br /></span></div></div>Jesse Shiehhttp://www.blogger.com/profile/02370410110943148171noreply@blogger.com228tag:blogger.com,1999:blog-5747208419659906777.post-49108130709943345272010-12-09T21:54:00.000-08:002010-12-09T22:30:57.281-08:00Why did we start Adku?<span style="border-collapse: separate; color: black; font-family: Times; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;"></span></span><br />
<div><div class="im"><div>We started <a href="http://www.adku.com/">Adku</a> to improve the world. That may seem like a grandiose vision, but we really believe that in order to create something that eventually does have the impact you want it to, you have to first believe that it's possible. </div><div><br />
</div></div></div><div>We're still in stealth mode and aren't disclosing too much about our product now, but we can talk about how we came up with the idea. We'd known and worked with each other for almost six years at Google, and we naturally gravitated towards each other as we're all entrepreneurial spirits. <br />
<br />
There were a few things that we wanted from any company we created: </div><div><ul><li style="margin-left: 15px;">Passion - We wanted to work on something we were very passionate about to the point of being obsessed. The kind of idea that you think about all the time (even in your dreams) and are willing to break through walls in order to deliver. Considering how much of your life you spend at your profession, it really shouldn't be seen as a chore, but rather as something you are excited to wake up and do every day. </li>
<li style="margin-left: 15px;">A difficult technical problem - We're all technical founders and we love computers and the power they bring. We wanted to create a solution that required large computing resources and that wasn't even possible to do as recently as one to two years ago. We're starting with real-time analysis of the vast data that's being created every second on the web and building a machine learning prediction engine to optimize eCommerce. </li>
<div><div class="im">
<li style="margin-left: 15px;">Solving an actual problem - We wanted to create a company that solved a problem that people experience today. Every potential customer that we talk to very quickly understands the pain point that we are addressing. </li>
</div>
<li style="margin-left: 15px;">Culture - We want to work with people that are fun and are friends. We want every new hire to be smarter than every previous hire at the company. We want an environment where communication is 100% open and everyone feels ownership in the product and company. We're going to do this together!</li>
</div></ul></div><div>From modest beginnings, we've all been fortunate to have been given great opportunities and skills in our lives. At Google we were responsible for products that are being used by billions of people, and we are even more excited about Adku. The first step in starting a company was the hardest, but as soon as we did it there was no doubt that it was the best decision we've made. </div><div><br />
</div><div>Adku is the beginning of a new journey. As with anything, there will be ups and downs, but we believe in our vision and will obsessively listen to our customers and will solve their needs. We plan to listen closely to everyone who takes the time to tell us how we can be better. </div><div><br />
</div><div>Please let us know if you are interested in learning more or in <a href="http://www.adku.com/jobs">working with us</a>! It's going to be an amazing ride.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1ruln814sXauxubDMVfiZ54CSfM_u5ugjoRJsb4DLSEnJRulI1IhNHc2EnGkiKBVR-nMpgnRNQtBBrR5EhTSKkJrnTpQCWSzEhEvLfZymoh7RbDQ3FRuqtg_RZqgOjDN1bBD-UAQC83OV/s1600/team_adku.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1ruln814sXauxubDMVfiZ54CSfM_u5ugjoRJsb4DLSEnJRulI1IhNHc2EnGkiKBVR-nMpgnRNQtBBrR5EhTSKkJrnTpQCWSzEhEvLfZymoh7RbDQ3FRuqtg_RZqgOjDN1bBD-UAQC83OV/s640/team_adku.jpg" width="444" /></a></div><br />
</div>Ajit Varmahttp://www.blogger.com/profile/15774628543200631695noreply@blogger.com137