Calum Knott

I'm currently employed by Didactic Services, a FESTO Partner, as a Senior Applications Engineer.
I'm currently the WorldSkillsUK Mechatronics Training Manager
I'm also a Visiting Lecturer at Middlesex University
Occasionally I can be persuaded to Freelance!

Contact Me

These posts are archived
They were written with an old blogging platform, and are no longer really maintainable, however as they are linked too from various pages on the web - it seemed a good idea to try and archive them. I have written just enough code to get them to display - but there will probably be a few broken links and images.
Any major queries - feel free to contact me

Inline Python

10 / 7 / 2014

I recently came across a post on reddit that joked about being able to include python in a website by using a <python> element. After pondering for a while, i came to the conclusion that actually, it wasnt a completely rediculous idea, and so decided to try and impliment it.

Download Demo

Using a browser implementation of python called Skulpt I was able to write a small piece of code that looked for <python> elements, and then compiled and ran them on page load. I also added the option for custom output divs using a data-attribute.

This code was written for FUN. It is probably not a good idea to use it for anything serious.
Also, Yes, I know about Brython

Here is how you use it

Here is the javascript implementation

Its not the worlds most complex code, but it was a good bit of fun. If you like it, Feel free to donate me a cup of coffee :)