This originally appeared in the Morning Star of Thursday September 28 2017. The print version (large PDF version here) included photographs by Hackney Cyclist and the Ranty Highwayman, to whom I’m incredibly grateful, of people going about their everyday lives by cycle in the Netherlands — which I think absolutely made it.

It is thankfully now accepted that if we are to stand any chance of tackling climate change we must change the way we move people and goods around.

Most talk has been about replacing petrol and diesel cars with electrics. Even our Tory government — whose ministers have never encountered a deposit of fossil fuel they didn’t want to dig up and set on fire — has set a date from which the sale of new oil-burning cars will be banned. Never mind that it’s the hopelessly and meaninglessly far away year of 2040.

We have to stop burning oil because it’s killing the planet. And that will kill us and our entire species. But the certainty of swapping our oil cars for electric cars as the next logical step for transport neatly somersaults over a flaming Cheddar Gorge full of problems.

But it isn’t the only path open to us; a different one can help us tackle not only the climate crisis but also many health and social problems. Environmental expert Alan Simpson wrote in these pages in July that “sustainability has to turn economics [and its obsession with GDP growth] on its head, putting work, wellbeing, security and inclusion at the centre.”

In the same way that we can’t just install a few gigawatts of renewable power and call it a day, we must think differently and, crucially, have the political courage to pursue an alternative strategy that upends most of a century of transport orthodoxy.

We are certainly barreling towards an electric-car future: France also wants to halt oil-car sales from 2040, India and bits of Germany 2030, Norway 2025. People will buy electrics instead of petrol and diesel; they plug in at home instead of filling up at a garage. Simple, done.

This doesn’t quite work though. For one, manufacturing a new car emits roughly as much CO2 as what comes out of the exhaust during its lifetime usage. And the equivalent to the per-mile emissions varies depending on how clean the electricity grid is; in Britain most power is from burning gas, with some coal, nuclear and wind.

It is also going to take a lot of electricity if we switch en masse to electric cars. It’s difficult to comprehend the huge amount of energy used by cars because they use a separate, somewhat obscured form of distribution — petrol stations.

National Grid warned this summer that, even under optimistic estimates, charging the expected number of electric cars in 2030 will use up all of the power from the under-construction Hinkley Point C nuclear plant. And it could be more than double the plant’s capacity — and this is the most expensive single object ever constructed on the planet.

Electric cars still add to air pollution — small particulate matter from tyre and brake pad wear which is damaging to health.

But the real problem is not the kind of motors we run on our roads — it’s the fact that the private car is the dominant mode of transport. We live in a car-dependent society, with people in many communities often legitimately having no other option. Since the 1950s Britain has very deliberately planned and provided for private car use and our streets and our society reflect that.

Car-dependence is killing us. Partly through pollution, which shortens lives to the point that it’s equivalent to 40,000 excess deaths a year. Partly through the 1,800 people killed and 22,000 seriously injured each year in car crashes. But mainly by eliminating physical activity from people’s day-to-day lives.

In Britain more than half of adults don’t do the recommended 150 minutes of “moderate” activity (hoovering, mowing the lawn, walking at 3mph) or 75 minutes of “vigorous” activity (jogging, swimming, cycling briskly) a week. Six million middle-aged people walk for less than 10 minutes at a go a month.

The effects on our health are huge. Inactivity is the fourth largest cause of disease and disability and contributes to one in six deaths from any cause. Worldwide, sedentary lives and resulting illnesses kill 5.3 million people a year. NHS England boss Simon Stevens has called growing obesity — inextricably but complexly linked to inactivity — “a slow-motion car crash in terms of avoidable illness and rising healthcare costs.”

The direct cost to the NHS is well over £1 billion a year, and wider economic costs from sickness and early death £6.5bn. Then there are costs as we live longer but in worse health — the Barnet “graph of doom” shows that within 10 years the rising cost of adult social care will leave the north London council with literally no money to spend on any other services (save statutory children’s services).

But fitting exercise into already busy days is hard, which is where transport comes in — getting about under our own steam and taking advantage of the “miracle pill” that is physical activity.

With the government focus for the past 60 years on the private car as the way to get about, it’s no surprise that 62 per cent of trips and 78 per cent of distance travelled in Britain is by car.

Over two thirds of journeys are shorter than five miles — a distance that, given the right conditions, could be easily cycled in less than half an hour. Yet more than seven in 10 journeys between one and five miles long are done by car.

The domination of the car for even short journeys also provides the answer for why more people don’t walk or cycle — it is unpleasant almost everywhere in Britain. 59 per cent of people think the roads are too dangerous for them to cycle on. This is what’s known as subjective safety: the risk of being hurt is lower than perceived — though still far too high — but people feel unsafe and are put off.

Thankfully we know what the answer is: taking road space away from cars and providing protected cycleways, such as the ones that opened last year in central London, John Dobson Street in Newcastle, and bits and pieces in Brighton, Leicester and elsewhere. Or the ones you see everywhere in the Netherlands.

We know they work and people like using them — bikes now make up the majority of vehicles during rush hour on Blackfriars Bridge in London, in just one lane of space. Or take Seville in southern Spain, which built about 80 miles of protected cycleways and turned fewer than 5,000 cycle journeys a day in 2006 into 72,000 in 2012 — going from a 0.5 per cent share of trips to 7 per cent.

Cycleways turn bikes from a hobby for the fit and the brave into a quick, cheap and easy way to get around for everyone. In the Netherlands three quarters of children cycle to school — able to get around independently in complete safety.

The same applies for older people, where having an easy and safe way to get about keeps up people’s health and decreases their social isolation. The director of the Dutch Cyclists’ Union tells Peter Walker in his book Bike Nation that while people tend to drive less from their mid-seventies as they feel less confident, they then cycle more. Not for nothing do people refer to the conditions as fit for 8 to 80-year-olds (and beyond).

For disabled people too, cycling can be a good way to travel independently as well as keeping healthy, as Wheels for Wellbeing has made crystal clear. People with impaired mobility often find it easier than walking and many use a cycle as a mobility aid.

We must alter our streets before we can reap the benefits of this — the road layouts we’ve inherited from the 1970s just don’t cut it. As a nice bonus we can start to make our towns more pleasant places to be, reclaiming space for people rather than cars.

Won’t this cause traffic chaos? No. You can move about seven times as many people on bikes as in cars in the same amount of space, and reducing the space for cars causes some of the traffic to evaporate, instead of taking different roads.

Doing this is going to cost money — particularly if we adopt a national plan to make these benefits available in every community, as we should. But it will cost substantially less than building roads, as the government is doing despite the evidence against being clear on all fronts. A mile of top-notch cycleway costs about £2-3 million. That’s 26 times cheaper per mile than the M4 bypass and 79 times cheaper than Crossrail.

Labour’s pledge to spend £10 per person per year on cycling infrastructure is a start — but it is just a start. The Netherlands already has a comprehensive network but still spends about £25 per head. Public health experts have long called for 10 per cent of transport budgets to be immediately allocated to walking and cycling.

In the long run it could save us a good deal: $24 trillion worldwide by 2050 if just 14 per cent of urban journeys are done by bike by then — less than what is achieved today in the Netherlands and Denmark. That figure does not even include the money saved through improved health, which would be substantial.

And that is from cycling alone. The same UC Davis study shows that cycling alongside improvements in public transport and a decline in private car use would save the world $128trn by 2050 in comparison to continuing as we are now.

Such a scenario would also halve the carbon emissions of the business-as-usual case, putting us firmly on track to avoid utterly catastrophic climate change.

Electric cars do have a role to play in our future — but we must be aware of the associated risks to our health and the environment of widespread private motor use, and choose a more ambitious path that can transform our communities for the better.

It’s a real shame that O’Reilly have now closed their store and are now only making their books available to people who subscribe to their Safari service or buy worse versions from Amazon.

Over the past four-ish years I’ve spent roughly $250 on O’Reilly books, and they’ve been a great way to learn new technical topics. Learning Web Design by Jennifer Robbins made something I’d previously found intimidating into a straightforward and enjoyable endeavour. Earlier this year I spent some time learning SQL with the Head First SQL book by Lynn Beighley and really enjoyed it. At the moment I’m reading Mark Lutz’s Learning Python — starting from the basics and working through what is quite a thick book (1,600 pages!) to improve my Python skills and make sure I’ve got the fundamentals nailed down.

They’re all great. I love the PDF versions as they’re incredibly well-typeset and fit perfectly on an iPad screen. It’s been nice to learn in the garden, at the kitchen table, in bed — all much more comfortable than sitting at my desk. And they’ve been updated repeatedly since I bought them to fix typos and other errors — the Learning Python errata page lists nearly 170 entries and the book has been updated 15 times since the publication of the third edition in June 2013, most recently this April.

The thing is, I’ve bought these books at various times over the past few years and generally only dipped into them to start and then come back later. Working through one will generally take me several weeks or even months. This is perhaps my third crack at Learning Python — not because it’s bad (it’s great!) but because I already knew enough Python to be dangerous and getting through the earlier sections took time and patience that I’ve not had until now.

This is not something that the Safari subscription allows for — particularly when as an individual and a hobbyist programmer I cannot begin to justify the $400 a year price. It’s another world to buying a $40 ebook so you can learn a particular topic or skill.

And what of reference books and cookbooks? I own both the Python Pocket Reference and the Python Cookbook — PDFs that I can dip into at any time and together would’ve been just $52 at full price.

You can still buy paper and Kindle versions of O’Reilly books through Amazon, but the PDFs are gone. Buying weighty print books on programming topics is not something I want to do — although JavaScript: The Definitive Guide, Sixth Edition and AppleScript 1-2-3 serve well lifting my iMac up 4″. And the Kindle versions share the typesetting problems of O’Reilly’s ePub versions (now also unavailable to purchase) and introduce Amazon’s DRM restrictions.

The tagline on the O’Reilly homepage is “Safari is how you learn.” It makes me feel a bit crap, frankly, as I can’t afford a Safari subscription (nor could I justify it if I could) and I don’t want to buy an inferior product from a third party.

Sadly that means I won’t be able to learn from O’Reilly books in the future.

I quite enjoy turning out little plots for posts on here. Admittedly I’m not great at it, but I like to have a go.

However, matplotlib really is not my favourite. It feels like there’s a lot of boilerplate to write and a lot of work to do before you get make something reasonably approaching what you had envisioned in your head.

So I thought I’d give R a try, and learn some things about visualisation along the way with Kieran Healey’s data visualisation course notes, which was fun.

But mostly in this post I wanted to show how ludicrously straightforward using ggplot2 can be compared with what you have to do in matplotlib. Let’s pick on my plot of train ticket prices from just before Christmas.

The Python code for that is quite long so I’m not going to include it, but it is available to view online. I’m not being completely fair because part of that involves getting the data into shape, and I’m sure there’s things I could’ve done to cut out a few lines.

That said, it took me a while to figure out exactly how to go about doing the plot in matplotlib, exactly how to, say, parse the dates and label the axis.

There was some of that with R and ggplot2, but mostly me looking things up in the documentation as I’ve not used them much. But mostly it was pretty straightforward to figure out how to build up the plot.

Anyway, here’s the plot:

A chart showing single train fares for selected journeys in England, France, Germany and the Netherlands on Friday December 23. This plot was made with R and ggplot2 instead of matplotlib.

And here’s the code that produced it:

 1 library(ggplot2)
 3 # Read in and convert string times to datetimes
 4 trains <- read.csv('collected.csv')
 5 trains$Time <- as.POSIXct(trains$Time, format = '%Y-%m-%dT%H:%M:%S')
 7 # Get the data onto the plot
 8 p <- ggplot(trains, aes(x = Time, y = Cost))
10 # 'Reveal' the data with points and show the
11 # East Mids price trend with a smoother
12 completed <- p + geom_point(aes(color = Operator)) +
13   geom_smooth(data = subset(trains, Operator == 'East Midlands Trains'),
14               aes(group = Operator, color = Operator),
15               method = 'loess', se = FALSE,
16               size = 0.75, show.legend = FALSE) +
18   # Let's adjust the scales
19   scale_x_datetime(date_breaks = '1 hour',
20                    date_labels = '%H:%M') +
21   scale_y_continuous(limits = c(0, 100),
22                      breaks = seq(10, 100, 10),
23                      expand = c(0, 0)) +
25   # Set some labels and adjust the look
26   labs(title = paste('Cost of single train tickets',
27                      'leaving European\ncapital cities',
28                      'on Friday December 23 2016'),
29        y = 'Ticket cost (€)',
30        color = 'Train operator') +
31   theme_bw(base_family = 'Trebuchet MS') +
32   theme(plot.title = element_text(hjust = 0.5))
34 ggsave('plot.svg', plot = completed, device = 'svg',
35      width = 8, height = 4, units = 'in')

I’m still figuring things out with R and ggplot so I’m not exactly blazing through. (I still haven’t figured out how to export transparent SVGs without editing them by hand.)

But I love the way that plots are built up out of individual pieces, which makes far more sense to me than trying to wrangle matplotlib’s figures and axes.

I added support for JSON Feed to my homemade static site generator Majestic today, and thought I’d note it because funnily enough the two implementations mentioned by John Gruber (by Niclas Darville and Jason McIntosh) used the approach I’d taken for generating my RSS feed and wanted to avoid.

Basically all three of those define a document template and pass in the posts and other required bits, and you’re done. I’m really not knocking this — again, I do this with the RSS feed and it validates fine. It’s all good.

But I ended up templating my RSS feed like this because I looked at the feedgenerator module and ran away. Majestic was my first Python project of any real size and I wanted to keep things as straightforward as I could. While it looks (with hindsight) reasonably OK in use, it doesn’t have any documentation, has been pulled out of Django, and has funky class names (Rss201rev2Feed) that didn’t fill me with confidence that I could implement an RSS feed quickly.

I was using Jinja templating for the site and since HTML and XML are cousins just did that. But you can probably tell that I didn’t really know what I’m doing (still don’t!) with escaping as any field that might contain non-Ascii characters is wrapped in <![CDATA[…]]> tags.

But hey, it works. Feed’s valid.

With JSON, everything just feels much more obvious. In Python you hand off basic types to the built-in json module and you get back a string, all the encoding taken care of. And if I make a mistake Python will complain at me, instead of just dumping out a file of questionable worth.

I think this is what all the people complaining on the Hacker News thread missed. Working in JSON is comfortable and familiar — the tools are good and you get told when something goes wrong. Working with XML can be unclear and a bit of a pain, and creating an invalid document is a risk.

So my super-duper advanced JSON Feed implementation is… constructing a dict, adding things to it and passing it off to the json module that I use all the time. Taken care of. The code’s so boring I’m not even going to include it here (but it’s online to view).

Diamond Geezer asks: “Why do we never end up in the middle?”

It’s unfair to pick on him, but I will because he posted on a day when my annoyance at centrist liberals has well and truly peaked.

First off, the “centre ground” is a concept that is entirely relative. When Jeremy Corbyn campaigned to become and was elected leader of the Labour Party in 2015, he managed to shift the centre ground — the Tories very quickly ditched a plan to bomb the Syrian government.

The centre ground is inherently unstable because it only exists relative to the two dominant forces either side. At our present moment that’s a fairly right-wing Conservative Party and a reasonably social democratic Labour Party. Any “centrist” must define themselves in opposition to their closest opponents on the left and right.

Ultimately if you do that it means you have no principles, nothing that anchors you on the left-right axis. In reality — as much as we joke about spineless politicians — few define their positions in this way and instead the “centre” in various countries is the home to a party that has “right-wing” economic policies and “left-wing” social policies. In Britain that would be the Liberal Democrats, despite Tim Farron’s recent attempts to win over the homophobes.

Left and right are in scare quotes above because this shows the point at which the left-right axis breaks down.

Ultimately the idea of centrism is bankrupt. Politics is a clash of interests. The ideas of the “centre ground,” of the “national interest,” are rubbish. Howard Zinn put it best in his People’s History of the United States:

Nations are not communities and never have been. The history of any country, presented as the history of a family, conceals the fierce conflicts of interest (sometimes exploding, often repressed) between conquerors and conquered, masters and slaves, capitalists and workers, dominators and dominated in race and sex.

As a socialist, to use our compromised axis, the boss class sits on the right and the workers on the left. Given that the boss class is but a tiny sliver of the population, what credibility does a “centrist” party have, one that pretends to balance the desires of the exploited and the exploiters?

It this this “refreshing centrism” that irks me the most, as it is always right-wing economic policies paired with some ameliorating factor — support for gay marriage, say — to assuage the liberals.

But if you’re gay, does being able to officially consecrate your relationship make up for the fact that you spend half your wages on rent?

This has run on, so let’s talk about Emmanuel Macron. The Guardian loves him, noting (without the expected contradicting clause) that it “is tempting … to conclude that European liberal values have successfully rallied to stop another lurch to the racist right.”

And so Macron, an explicit neoliberal, is raised up having defeated (we’ll see) the fascist Marine Le Pen.

The celebration is of liberal values, embodied by Macron. But Macron’s liberal values go a long way to explain the surge in support for France’s fascist National Front, as Cole Stangler shows. His liberal values are likely to increase “unemployment, inequality and poverty” through his right-wing economic policies — along the lines of the French law that bears his name (loi Macron) and hacked away at workers’ rights.

The assault on workers’ rights and public services has been ongoing for nearly 40 years yet liberals and centrists deride the term that describes our current phase: neoliberalism.

The refusal to recognise this trend puts us in a position where the Guardian celebrates the likely victory of Macron, cheering his defeat of the fascists in blissful ignorance. But his political current is the reason why we have ended up with the fascists contesting the second round of the French presidential election (again).

Faced with falling employment and living standards for four decades and (generally) abandoned by the organised left, people have turned to those who promise to take action to improve their material conditions.

Yet Macron’s policies will just exacerbate these problems. This isn’t the end of the fascist challenge in France; should Macron win and pursue his neoliberal programme we could well be in the same situation in five years’ time.

(Unless, potentially, the French left organises a strong anti-fascist campaign like that waged in Britain from the 1970s to the present time, in which the fascists have more or less been suffocated.)

This isn’t a “bold break with the past,” it is the continuation of the rule of the boss class with a fresh coat of paint.