Python 2.7

EAFP is a Python acronym that stands for easier to ask for forgiveness than permission. This coding style is highly pushed in the Python community because it completely relies on the duck typing concept, thus fitting well with the language philosophy.

The concept behind EAFP is fairly easy: instead of checking if an object has a given attribute or method before actually accessing or using it, just trust the object to provide what you need and manage the error case.



An Introduction to Python Lists
Python Lists


Python Dictionary
Add to a dictionary in Python?
Python add new item to dictionary [duplicate]

Iterators & Generators

Iterators & Generators

Classes and Objects

Object Oriented Programming
Python’s Super is nifty, but you can’t use it
correct way to use super (argument passing)
Python 3 OOP Part 1 – Objects and types
Python 3 OOP Part 2 – Classes and members
Python 3 OOP Part 3 – Delegation: composition and inheritance
Python 3 OOP Part 4 – Polymorphism
Python 3 OOP Part 5 – Metaclasses
Python 3 OOP Part 6 – Abstract Base Classes


15.7. logging — Logging facility for Python
Logging HOWTO on
Logging Cookbook on
Good logging practice in Python
PyMOTW – logging – Report status, error, and informational messages
Python Guide – Logging


3.4.1. Basic customization (__init__, __str__, …)

Uniform Access Principle / Property / Class Attribute

“public” or “private” attribute in Python ? What is the best way?
Python Class Attributes: An Overly Thorough Guide
What’s the difference between a Python “property” and “attribute”?
Private Variables and Class-local References
Implementing Descriptors

old-style vs. new-style

New-style Classes
What is the difference between old style and new style classes in Python?
old-style and new-style classes in Python 2.7? [duplicate]

args and kwargs

Understanding kwargs in Python
*args and **kwargs? [duplicate]
What does ** (double star) and * (star) do for Python parameters?

Webserver / WSGI

Web Server Gateway Interface (WSGI) Servers

Documentation / docstring

sphinx.ext.napoleon – Support for NumPy and Google style docstrings
Example Google Style Python Docstrings
Example NumPy Style Python Docstrings

PEP 257 – Docstring Conventions
PEP 258 – Docutils Design Specification
numpy – How-to document
How to document a method with parameter(s)?
Sphinx Code Example

How to document fields and properties in Python?
How to document class attributes in Python?

Rewriting Python Docstrings With a Metaclass


File -> Settings -> Build, Execution, Deployment -> Python Debugger -> Collect run-time types information for code insight

Using Docstrings to Specify Types
Creating Documentation Comments
Generating Reference Documentation (DocUtils, Sphinx)
Python Integrated Tools (Docstring format: Plain, reStructuredText, Epytext)
Documenting Source Code in PyCharm (reStructuredText, Epytext)
PY-9795: wish list item: support for google python style type comments (sphinx.ext.napoleon)

Leave a Reply

Your email address will not be published. Required fields are marked *