python-cookbook
python-cookbook copied to clipboard
Code samples from the "Python Cookbook, 3rd Edition", published by O'Reilly & Associates, May, 2013.
Closes #13 I have added one more exception which will raise a TypeError because the key is not of type str and fixes already fixed invalid syntax error. I hope...
Hi, In chapter 9.9, I don't understand the below code, especially in ```__init__()```. It uses ```wraps(func)(self) ``` in ```__init__()```, but it doesn't assign ```wraps(func)(self) ``` to ```self```. Why ```self.__wrapped__``` can...
There is a small typo in src/12/defining_an_actor_task/tagged.py. Should read `corresponding` rather than `correponding`. Semi-automated pull request generated by https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md
https://github.com/dabeaz/python-cookbook/blob/6e46b78e5644b3e5bf7426d900e2203b7cc630da/src/12/launching_a_daemon_process_on_unix/daemon.py#L76
I don't understand the function of flag in example2 how_to_determine_if_a_thread_has_started (12.2). The scripts works fine when I remove the flag part likes below. ``` import threading import time class PeriodicTimer:...
should be re.compile(r'"(.*)"') because with r'...', backslashes will be remained so the findall should return [],The fix should be to delete the two backslashes.
The code is not provided with any kind of license, making it difficult to determine if these snippets can be used in a professional context.
The code has missed ignore_types arg when calling the method of `flatten` recursively in the example about how to flatten a nested sequence. `src/4/how_to_flatten_a_nested_sequence/example.py` ```python from collections import Iterable def...