Issue in Ch04, timing.py
See original GitHub issueThe 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:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
@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.