Python

All Hail The Mighty Vim

Vim is a cruel learning curve, it’s a long way from modern text editors, and yet it is still a popular choice for programmers. Why?! Because it’s worth it. There are many things Vim does well, many things that I could use to show it off. But for this post, I had to choose only one thing, which is evaluating commands.

Python Generators, yield and send

Another little known Python feature that deserves more love. This time we’re looking at the send function that lets you input values into your generator as it’s running. It works through yield and is awesome!

RDFLib Graph with RDBS

It’s tricky to find out how to set up RDFLib Graph to use a RDBS backend, but it can be done using SQLAlchemy and RDFLib-SQLAlchemy. This means it’ll support all the engines SQLAlchemy does, including MySQL and Postgres. I’ll highlight two gotchas to look out for when using RDFLib-SQLAlchemy and walk you through getting setup using a wrapper class to RDFLIB Graph.

Semantic Web for Google

Google makes extensive use of Semantic Web technologies, although they prefer the term Knowledge Graph. In this post I’ll show you how to add structured data to a Flask Blog app, with JSON-LD and Jinja2 templates to help Google understand your content, which in turn should improve SEO.

Semantic Web for Facebook

Facebook use the Semantic Web. They have an ontology called “Open Graph” that links your webpage into their social graph. This means when someone shares your webpage on Facebook, it’ll look how you’ve specified. In this post I’ll show you how to include this in a Flask blog application with a Jinja2 template.

Guido was right, there should be no lambda in Python.

Python has support for lambda functions, Haskell is built upon lambda calculus. The two are not the same and this is the reason why lambda should have been removed in Python3. This post examines the differences, reviews the use in Python, and offers a more pythonic, honest syntax.

Python Partial: Code Your Intention

Of all the functional programming inspired features in Python, partial application must be the best kept secret that you really need to know. Partial application lets you create highly abstract functions and make them more specific for use, pass a function arguments without calling it yet, and so much more.