Categories for:

My class is bigger than your class

Python classes are great. But they can be better. Take a look at this class, let's call it Foo: Yes, try as it might, this puny class doesn't even know if it's bigger than 0 or not! It would not help to define a __gt__... View Article

Reply

5 Lark features you probably didn’t know about

If you've ever used Lark, you probably already know that it's rather featureful compared to other parsing libraries. Even when it was first released, five years ago, it already had two parsing algorithms, several lexers, automatic AST construction, automatic line counting, and the list goes... View Article

3 Comments

Create a stand-alone LALR(1) parser in Python

Over the years, I noticed that many developers are reluctant to use parsing libraries, especially if the language they need to parse is relatively small. The reason is that they wish to avoid adding external dependencies to their project. Although pip (setuptools) can automatically fetch... View Article

3 Comments

How to write a DSL (in Python with Lark)

The first time I used Logo, it felt like magic. I could type a short sequence of simple commands, and draw beautifully complex shapes on the screen. In this tutorial, I will show you how to parse and interpret a Logo-like language in just 70... View Article

9 Comments

Baker – Expose Python to the Shell

It's been a long time since my last post, and it would be appropriate that I post about whatever it is that I've been working on. But I won't. I'm writing this post only to tell you about an interesting new python library I stumbled... View Article

1 Comment

PySnippets – improving code reuse

For a long time now, I've been hindered by the issue of utilities, or snippets. These are convenience functions and classes that are too small or too incomplete to justify a library, yet are useful enough to be used. I've posted a few on my... View Article

5 Comments

FileDict – bug-fixes and updates

In my previous post I introduced FileDict. I did my best to get it right the first time, but as we all know, this is impossible for any non-trivial piece of code. I want to thank everyone for their comments and remarks. It's been very... View Article

6 Comments