Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent code from overflowing pre block #34

Merged
merged 12 commits into from
Jan 8, 2016
7 changes: 4 additions & 3 deletions book/analysis/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ If we perform 5 invocations of the function, each computing the sum of
the first 10,000 integers, we get something like the following:

```
>>> output_template = 'Sum is {}, required {:10.7f} seconds'
>>> for i in range(5):
... print('Sum is {}, required {:10.7f} seconds'.format(sum_of_n(10000)))
... print(output_template.format(sum_of_n(10000)))
Sum is 50005000, required 0.0018950 seconds
Sum is 50005000, required 0.0018620 seconds
Sum is 50005000, required 0.0019171 seconds
Expand All @@ -70,7 +71,7 @@ process for the first 100,000 integers?

```
>>> for i in range(5):
... print('Sum is {:d}, required {:10.7f} seconds'.format(sum_of_n(100000)))
... print(output_template.format(sum_of_n(100000)))
Sum is 5000050000, required 0.0199420 seconds
Sum is 5000050000, required 0.0180972 seconds
Sum is 5000050000, required 0.0194821 seconds
Expand All @@ -83,7 +84,7 @@ averaging about 0.019 seconds. For `n` equal to 1,000,000 we get:

```
>>> for i in range(5):
... print('Sum is {}, required {:10.7f} seconds'.format(*sum_of_n(1000000)))
... print(output_template.format(*sum_of_n(1000000)))
Sum is 500000500000, required 0.1948988 seconds
Sum is 500000500000, required 0.1850290 seconds
Sum is 500000500000, required 0.1809771 seconds
Expand Down
3 changes: 2 additions & 1 deletion book/chapter.css
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ ol.chapters {
padding: 0;
}

code[class*="language-"] {
code, code[class*="language-"] {
font-family: Inconsolata, Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
}

pre {
background: rgba(242, 242, 242, 0.5);
padding: 20px;
overflow-x: scroll;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioned it in my general comment, but I think this rule created an extra line at the bottom of each pre box! Catastrophe!

}

figure {
Expand Down
5 changes: 4 additions & 1 deletion book/graphs/implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ class Vertex(object):
self.neighbors[neighbor] = weight

def __str__(self):
return '{} neighbors: {}'.format(self.key, [x.key for x in self.neighbors])
return '{} neighbors: {}'.format(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this change actually affect spillover in those boxes? Or does this address character limits in a text editor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must have been spilling over... the character limits I'm only enforcing in .py files as that's where my linter runs 😄

self.key,
[x.key for x in self.neighbors]
)

def get_connections(self):
return self.neighbors.keys()
Expand Down
3 changes: 2 additions & 1 deletion book/queues/hot_potato.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ def hot_potato(names, num):
return queue.pop()


hot_potato(('Bill', 'David', 'Susan', 'Jane', 'Kent', 'Brad'), 7) # => 'Susan'
hot_potato(('Bill', 'David', 'Susan', 'Jane', 'Kent', 'Brad'), 7)
# => 'Susan'
2 changes: 1 addition & 1 deletion book/stacks/what-is-a-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ them.
Here is another stack, this one contains a number of primitive Python
data objects:

![A Stack of primitive Python objects](figures/primitive.png)
![A stack of primitive Python objects](figures/primitive.png)

One of the most useful ideas related to stacks comes from the simple
observation that the order of insertion is the reverse of the order of
Expand Down