Skip to main content

This is a new website theme. Help me improve it and give your feedback (opens in a new tab).

Python

List Comprehension

Still in the process or tidying up the bot behind the @TorAtlas Twitter account, which means I’m still writing Java. I’ve now been exploring “list comprehension"-like techniques using another new Java 8 feature, Streams. Essentially this involves creating lists from lists in an elegant way. In Python, I would do something like: runningRelays = [relay for relay in relays if relay['is_running']] (I know something is happening because writing that example line I had an incredible urge to terminate the line with a semicolon.

Starting with Python

For absolutely ages I’ve been wanting to start to learn Python, but I always find it hard to think of a system to try and implement that will test me and force me to learn things I don’t already know. Luckily, where I’m learning Java as part of my University degree, there’s a whole load of problems to solve and all I have to do is translate them into Python.