How To Build a Simple API with Flask and Unit Test it

Posted by Bob on Fri 03 March 2017 in Flask • Tagged with APIs, Flask, REST, curl, testing, unittest, inventory • 3 min read

In this post I will create a simple API with Flask and test it with curl and unit testing its HTTP methods.


Continue reading

5 tips to speed up your Python code

Posted by Bob on Tue 21 February 2017 in Best practices • Tagged with performance, data structures, pythonic, generators, map, builtin, algorithms, regex, patterns • 5 min read

In this post I will give you 5 tips to speed up your code.


Continue reading

Visualizing website and social media metrics with matplotlib [notebook]

Posted by Bob on Wed 08 February 2017 in Data • Tagged with matplotlib, visualization, histogram, jupyter, data analysis, data science, socialmedia, googletrends • 12 min read

in this notebook i use matplotlib.pyplot to create simple yet powerful visualizations of pybites twitter activity, our blog's tag usage and our website traffic. Lastly I use Google trends to see popularity of various social media.


Continue reading

Python Tricks book review

Posted by Bob on Tue 31 January 2017 in Books • Tagged with review, tricks, tips, pythonic, oop, ABC, dicts, cleancode • 2 min read

A review of Dan Bader's Python tricks book.


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

Errors should never pass silently

Posted by Bob on Wed 18 January 2017 in Best practices • Tagged with exceptions, Zen of Python, error handling, cleancode, anti-patterns • 3 min read

In this article some important anti-patterns regarding error handling and how to solve them making your code more Pythonic and easier to maintain.


Continue reading

5 cool things you can do with itertools

Posted by Bob on Thu 12 January 2017 in Modules • Tagged with iterators, itertools, tricks, generators, game, notebooks, permutations • 2 min read

Itertools is a very useful module. In this short post I show some 5 examples how you can use it. Some of this stuff might be useful in next week's challenge ...


Continue reading

Beautiful, idiomatic Python

Posted by Bob on Tue 10 January 2017 in Best practices • Tagged with pythonic, cleancode, collections, 2vs3, namedtuples, decorators, contextmanagers • 2 min read

Transforming Code into Beautiful, Idiomatic Python is a must-watch to write more Pythonic code. In this post some highlights.


Continue reading

Code Challenge Pilot - code review

Posted by Bob on Thu 05 January 2017 in Challenges • Tagged with codechallenges, refactoring, code review, bestpractices, pythonic, git, Github, git flow, vim, assert • 4 min read

In this post I review the code of challenge # 1 and refactor it to make it more Pythonic.


Continue reading