Dunder methods power most operators in Python as well as some of the built-in functions. Dunder methods are a contract between the person who made a class and Python itself.| www.pythonmorsels.com
The range function can be used for counting upward, countdown downward, or performing an operation a number of times.| www.pythonmorsels.com
Need to loop over two (or more) iterables at the same time? Don't use range. Don't use enumerate. Use the built-in zip function. As you loop over zip you'll get the n-th item from each iterable.| www.pythonmorsels.com
Sequences are iterables that have a length. Sequences are ordered collections (they maintain the order of their contents). The most common sequences built-in to Python are string, tuple, and list.| www.pythonmorsels.com
Context managers power Python's with blocks. They sandwich a code block between enter code and exit code. They're most often used for reusing common cleanup/teardown functionality.| www.pythonmorsels.com
Is your Python program printing out a traceback? You have an uncaught exception! You can catch that exception with a try-except block.| www.pythonmorsels.com
In Python, slicing looks like indexing with colons (:). You can slice a list (or any sequence) to get the first few items, the last few items, or all items in reverse.| www.pythonmorsels.com
Python's built-in enumerate function is the preferred way to loop while counting upward at the same time. You'll almost always see tuple unpacking used whenever enumerate is used.| www.pythonmorsels.com
Python's built-in functions list includes 71 functions now! Which built-in functions are worth knowing about? And which functions should you learn later?| www.pythonmorsels.com
Unlike traditional C-style for loops, Python's for loops don't have indexes. It's considered a best practice to avoid reaching for indexes unless you really need them.| www.pythonmorsels.com
Iterators are lazy iterables which power all iteration in Python. Iterators are the generic form of a generator-like object.| www.pythonmorsels.com
Classes are for coupling state (attributes) and functionality (methods). Calling a class returns an instance of that class. Class and "type" are synonyms in Python.| www.pythonmorsels.com
Source code: Lib/io.py Overview: The io module provides Python’s main facilities for dealing with various types of I/O. There are three main types of I/O: text I/O, binary I/O and raw I/O. These ar...| Python documentation
An iterable is anything you're able to iterate over (iter-able). Iterables can be looped over and anything you can loop over is an iterable. Not every iterable is indexable or has a length.| www.pythonmorsels.com
Source code: Lib/_collections_abc.py This module provides abstract base classes that can be used to test whether a class provides a particular interface; for example, whether it is hashable or whet...| Python documentation
You don't need third-party libraries to read CSV file in Python! Python's csv module includes helper functions for reading CSV files, tab-delimited files, and other delimited data files.| www.pythonmorsels.com
Definitions for colloquial Python terminology (effectively an unofficial version of the Python glossary).| www.pythonmorsels.com