Mon 07 Nov 2022

Haskell, Python, and Readability

This weekend on /r/programming someone posted a nice introduction to tries using Python. A while ago, I had implemented a mini web server to do completion and correction of words using Ternary Search Tries in Haskell, and since the trie post generated a lot of interest I decided to post mine too.

Then, someone else posted a blog article commenting on the readability of Python and Haskell based on my web server code and the trie example, concluding that the Python version was much more readable.

Source: Haskell, Python, and Readability, an article by Francesco Mazzoli.

Better Python code grepping with pyastgrep

A few weeks ago I released pyastgrep, a tool for grepping Python code at the syntax level (using AST - Abstract Syntax Trees), and today I released some more improvements.

It builds on an earlier tool, astpath which now appears to be abandoned, and also had quite a few bugs. I’ve fixed lots of things and re-written quite a bit internally in backwards incompatible ways, so a fork was the easiest way forward. I’ve also been able to make lots of improvements to default behaviour, inspired by tools like ripgrep. For example, it automatically exclude paths that match discovered .gitignore files, which can make a massive performance improvement in some cases (looking at you, node_modules).

Source: Better Python code grepping with pyastgrep, an article by Luke Plant.

Python List Comprehensions Are More Powerful Than You Might Think

Python's list comprehensions (and generators) are an awesome feature that can greatly simplify your code. Most of the time however, we only use them to write a single for loop, maybe with addition of one if conditional and that's it. If you start poking around a bit though, you will find out that there are many more features of Python's comprehensions that you don't know about, but can learn a lot from...

Source: Python List Comprehensions Are More Powerful Than You Might Think, an article by Martin Heinz.

Is There Too Much CSS Now?

As front-end developers, we’ve wished for a lot of things over the years — ways to center things in CSS, encapsulate styles, set an element’s aspect ratio, get finer-grained control over our colors, select an element based on its children’s properties, manage layers of specificity, allow elements to respond to the width of their parents… the list goes on and on.

And now that we got all we wished for and more, some of us are asking — do we now have too much CSS?

Source: Is There Too Much CSS Now?, an article by Sacha Greif.