Category Archives: python

Python Variable Function Arguments

Python variable function arguments are typically represented by the somewhat arcane-looking ‘*args’ and ‘**kwargs’ arguments in a function signature. Using python variable function arguments frees you from having to know in advance exactly how many arguments a function or method will take, which can be very useful. Variable Function Arguments There are two ways we… Read More »

Flask RESTful API JSON

JSON is a common format for sending data to and from a RESTful API. In this post we’ll see how we can allow a simple Flask API to receive a JSON input. This post extends my previous post which made a simple Flask RESTful API and uses the Flask ‘get_json()’ method to accept JSON input.… Read More »

Use Tox With Anaconda

Tox is a tool for building and running a matrix of test environments. This is useful when, for example, you need to support several different versions of python. You don’t want to have to manually run tests againsts each of your supported versions. This post shows you how you can use tox with anaconda. If,… Read More »

Python – Unpacking Iterables

Python iterables are lists, tuples, dictionaries and other similar objects – in other words things that can be iterated over. Python provides a way to ‘unpack’ these iterables which can be a useful shortcut in some situations. This post looks at unpacking iterables, and how it can also be used to make functions functions take… Read More »