Latest articles tagged python

Teaser image

Pelican is a static site generator written in Python, which was used to create this site. Extending Pelican with plugins can be a powerful tool, but unfortunately when going to create my own first plugin, I found documentation to be somewhat lacking. So, I'd like to provide a few tutorials demonstrating how I built plugins for this site, starting with a very simple one.

This article assumes basic familiarity with Python, and working with Pelican to create a basic blog site, but does not assume knowledge of Pelican internals. Read more...

Teaser image

It hit me recently that I didn't understand something about how generator functions in Python work. In short, I was unsure exactly when and how they are determined by a Python implementation to be generators as opposed to "standard" functions, i.e. a function ending in return (whether explicit or falling off the end of the function).1 That question may not make very much sense at this point, but I'm not sure how to succintly word it without background information. To that end, there are three key facts about generator functions that led me to this question, described below. Read more...

Teaser image

The previous articles about the topic of Python function attributes gave an example of how a decorator can be used to add functionality to a given function using function attributes. It then introduced an alternative approach using classes, and no function attributes, to achieve similar functionality.

The purpose of this article is to examine these two approaches in-depth to see if they hold up as "interchangeable", or if perhaps one approach has distinct advantages over the other. At its end, I'll share my view on the status of function attributes. Read more...

Page 1 / 2 »