The Simple Way to Find the Correct Syntax

It happens to the best of us, you are writing some code in a Language that you use sporadically and you start asking yourself what is the correct syntax for this or that. You know many languages and you start wondering how do you iterate the elements of a collection? Is it foreach, for .. in or something else? You know the answer, you just need a second or two… it’s matter of pride! You are a professional and you are going to remember it…

Let’s not kid ourselves you are going to search for it, in a search engine or directly on stackoverflow. Or maybe you are going to search for a cheat sheet in Duck Duck Go.

A Better Alternative (Sometimes)

It works, but it’s not always perfect. Sometimes you have to browse different questions or to sift through a long and erudite answer about the performance profile of the different options of looking the characters in a string. Which is cool, but you just need to refresh how to do it not how to optimize to death a 40-lines script. So now there is an interesting alternative: SyntaxDB. It’s both a search engine for syntax and a reference. Actually it’s called reference, but it’s a bit better than a standard reference and a bit worse.

SyntaxDB Python Reference

As you can see it’s better in the sense that it provides some guidance, something that is not always available for all references, and a generic structure for many different languages. It’s also a bit worse because it’s not complete, in fact there are many level of completeness. You can’t even say that they cover all the basics (like strings) for all the languages. It seems that the author has inserted the constructs that came in his mind and then he tried to gave a structure to them and choose some languages to cover. And probably that’s pretty much what happened since it is the work of a single author. Indeed a very competent one, but it’s not service from a company.

The Future is Bright

Don’t get me wrong, it’s a good idea that it is implemented well and it actually works if you really need to find the syntax for for in python. Also the author is working on letting everybody contribute:

Something I’m very happy and surprised with is the number of people asking how they can help. The most requested feature for SyntaxDB has been a way to let you developers contribute, and I’m happy to say that’s the next feature I’ll be working on!

from the About page

It’s just that not all the content it’s there. Plus it seems that only one version of any language is supported, which is something that can really be a problem in languages such as Python which, for some reason, it’s still very much split between version 2 and 3.

Another good reason to follow the service is that is indeed well designed and thought for the contemporary world. What I mean is that there is already an API and its implementation follows the Swagger/OpenAPI Specification. There are already integrations with editors/IDEs such as Visual Studio Code and Atom. And there is even one for the Duck Duck Go search engine and a bot for Slack. I think it’s off to a good start, it just need some time to develop.