Uploaded December 2016 | Updated September 2026, 3 weeks ago
[buymeacoffee.com/cogsci] This video is a follow-up to 7 Simple Tricks to Write Better Python Code. It again shows seven simple techniques for writing better and easier-to-read Python code.
- 00:30 Inline if-else statements
- 03:00 Sequence comparisons
- 10:00 Extended unpacking (Python-3 only)
- 13:57 Dict comprehensions
- 18:25 collections.OrderedDict
- 21:30 collections.defaultdict
- 26:17 collections.Counter
[buymeacoffee.com/cogsci] This video is a follow-up to 7 Simple Tricks to Write Better Python Code. It again shows seven simple techniques for writing better and easier-to-read Python code.
- 00:30 Inline if-else statements
- 03:00 Sequence comparisons
- 10:00 Extended unpacking (Python-3 only)
- 13:57 Dict comprehensions
- 18:25 collections.OrderedDict
- 21:30 collections.defaultdict
- 26:17 collections.Counter





![Running Python code with Rapunzel Code Editor
[https://www.buymeacoffee.com/cogsci] Rapunzel is a code editor for numerical computing with Python and R. In this video, I show how run Python code directly from the editor. For more information, visit https://rapunzel.cogsci.nl/ Running Python code with Rapunzel Code Editor](https://i.ytimg.com/vi/UYKIIsyex1g/mqdefault.jpg)
![Python Generators 1: Functions that yield, suspend, and resume
[https://www.buymeacoffee.com/cogsci] For more Python tutorials, visit http://python.cogsci.nl/. In this video, I demonstrate the basic principle of generator functions (functions that yield) in Python. Code is available on osf.io/eyxc3. Python Generators 1: Functions that yield, suspend, and resume](https://i.ytimg.com/vi/Ut0-_eMVakU/mqdefault.jpg)
![Generator expressions in Python [Python comprehensions #4)
[https://www.buymeacoffee.com/cogsci] In this video, I demonstrate generator expressions in Python. These are a way to implement a generator with a list-comprehension-like syntax. The notebook for this video is available at https://osf.io/wshd5/. For more tutorials, visit https://python.cogsci.nl/. Generator expressions in Python [Python comprehensions #4)](https://i.ytimg.com/vi/V2FOlOW0bTs/mqdefault.jpg)
![7 Simple Tricks to Write Better Python Code
[https://www.buymeacoffee.com/cogsci] Visit http://python.cogsci.nl/ for more tutorials! Seven solutions to common small problems that Python programmers often solve in a suboptimal way. This video is understandable for beginners, but also contains useful advice for experienced programmers.
- 0:50 Using enumerate()
- 3:22 Using zip()
- 6:35 Tuple unpacking
- 9:40 Default dict values
- 12:42 For ... else
- 16:13 File reading with with
- 19:40 Exception handling 7 Simple Tricks to Write Better Python Code](https://i.ytimg.com/vi/VBokjWj_cEA/mqdefault.jpg)

![Creating a command-line app in Python [PythonLiveLessons #4]
The fifth episode of #PythonLiveLessons, a weekly live stream about Python code and more, hosted by Sebastiaan Mathôt. In this episode, well turn our `markdown_code_exec` Python module, which we created in previous episodes, into a command-line application! Well learn about the `argparse` module to parse command-like arguments, about entry points, and about the if name main convention.ing Creating a command-line app in Python [PythonLiveLessons #4]](https://i.ytimg.com/vi/VcgBAwdz7aA/mqdefault.jpg)