question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue in Ch04, timing.py

See original GitHub issue

The timing module by default executes the statement for 1 million times (link): timeit.timeit(stmt='pass', setup='pass', timer=<default timer>, number=1000000)

So the output of this line in the timing.py module should be in us not ms:

result = timeit(setup=setup, stmt=statement)
print(f'Took an average of {result}ms')

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bluekeybocommented, Apr 29, 2020

Oh I agree. For clarity’s sake, also use the actual loop count you want to run in the function call so there’s no confusion with the default used.

0reactions
daneahcommented, May 1, 2020

@bluekeybo I’ve created an errata.html file in this repo that should include all the points you’ve made along with some from liveBook feedback. This should also eventually appear on the book’s page on manning.com as well. Thanks for your help! Keep them coming as you find them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LearningAlgorithms/launch.bat at main · heineman ... - GitHub
echo "Generating Timing results for each chapter. Should take about one hour." %PYTHON3% algs\timing.py > algs ...
Read more >
Chapter 4 | Python For Everyone | Trinket
Pertaining to a sequence of numbers that appear to be random, but are generated by a deterministic program. The result of a function....
Read more >
4. Code Reuse: Functions and Modules - Head First Python ...
Naming a Chunk of Code with “def” Once you've identified a chunk of your Python code you want to reuse, it's time to...
Read more >
4 Writing Structured Programs - NLTK
Here we pick up on some issues of programming style that have important ramifications for the readability of your code, including code layout,...
Read more >
4. Conditionals and loops — Beginning Python Programming ...
Or if you need to print the 12 times table, we know right away how many times the loop will need to run....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found