Learning Python Decorators by Example

Posted by Bob on Fri 20 October 2017 in Concepts • Tagged with decorators, design patterns, logging, caching, memoization, Flask, Django, properties, classmethod, staticmethod, lru_cache, mock.patch, contextmanager • 4 min read

Decorators are a sometimes overlooked feature and they might be hard to grasp for beginning Pythonistas. I agree with Aaron Maxwell that mastering them "can massively magnify the positive impact of the code you write", so make sure you add them to your toolkit if not done so already. In this article I explain what they do, why you want to use them and give some practical examples.


Continue reading

The Importance of Refactoring Code

Posted by Julian on Thu 13 July 2017 in Concepts • Tagged with python, beginner, learning, examples, code, refactoring • 4 min read

In this quick post I discuss why refactoring code is one of the most important parts of the learning process.


Continue reading

Next Time I Will Use Pandas to Parse Html Tables

Posted by Bob on Thu 08 June 2017 in Concepts • Tagged with BeautifulSoup, regex, Pandas, parsing, data, data cleaning, energy, json, csv, html • 2 min read

Last week I did some html table parsing with BeautifulSoup and regex. It turns out there is an easier way to do this: Pandas.


Continue reading

OOP Beyond the Basics: Using Properties for Encapsulation, Computation and Refactoring

Posted by Bob on Wed 31 May 2017 in Concepts • Tagged with oop, property, decorators, encapsulation, computation, dunder, refactoring, pytest, 2vs3, getter, setter • 4 min read

In this article I share my learning of the property decorator coding a simple Account class. I think it's an unmissable tool in your (Python) OOP toolkit.


Continue reading

Generators are Awesome, Learning by Example

Posted by Julian on Fri 17 March 2017 in Concepts • Tagged with python, tips, code, pybites, generators, iteration, yield • 5 min read

Learn what a Generator is and check out some different examples.


Continue reading

Don't let mutability of compound objects fool you!

Posted by Bob on Tue 07 March 2017 in Concepts • Tagged with list, mutable, copy, deepcopy • 3 min read

In this article I explain the difference between shallow versus deep copy with a working example. It's an important concept when working with compound objects.


Continue reading

Python's data model by example

Posted by Bob on Wed 25 January 2017 in Concepts • Tagged with datamodel, oop, magicmethods, builtin, pythonic, iterators, slicing • 14 min read

After last post on OOP a logical follow-up is Python's data model. We use the great Fluent Python book to code up an example of our own, showing the powerful way you can leverage this data model. You can download the notebook here.


Continue reading

Everything is an Object, Python OOP primer

Posted by Bob on Tue 24 January 2017 in Concepts • Tagged with tutorial, oop, objectoriented, programming, inheritance, polymorphism, ABC, encapsulation, property • 13 min read

I created a notebook on OOP (object oriented programming) in Python.


Continue reading

Python Iteration

Posted by Julian on Thu 19 January 2017 in Concepts • Tagged with python, tips, tricks, iteration, resources • 3 min read

Iteration in Python is incredibly simple compared to C and other languages. It's easy... maybe a little TOO easy...


Continue reading