Table of Contents
1 A better python
I am not entirely happy with python, but there is so many benefits in using python, if only there was a way to use python with all the benefits but not having to deal with some of the downsides.
credit: hy-lang
1.1 Introducing Hy
Oh wait but there is, it is called hy. Now if you are not a "crazy lisp user" you might not be all that hot on the idea of writing parentheses around all your code all the time, but there is a few benefits to this, also it is not more parens really they are just placed differently.
(print "Hello, World!")
Only the parens are different between these two.
print("Hello, World!")
it is the same characters, just the paren changed place in hy, now this is a simple example. There are some benefits from this one is the fact that more functional style code is possible in hy, which is not possible in python directly.
1.2 Differences
So there is a few small differences that you need to know.
1.2.1 Tuples
1.2.2 List
1.2.3 Set
1.3 Hy adds stuff to python
So since hy is a lisp that runs on python there are things in hy that python does not have by itself.
1.3.1 macro
This can be very useful if you want to do some heavy compilation, but ideally if you could just do it at compile time and then never again that would be very nice, this is exactly what macros do, oh and allow you to crazy things like adding new language features, well to some extent at least.
The only thing you should be aware about with macros is that if you do not have a value at compile time it cannot be a macro.
(defmacro m [] (setv x (** 2 20)) x)
If you run this twice, it will take some time once, but then the second time it is compiled into the program and returns much much faster.
If this has whetted your appettite for a better way to write python there is additional documentation https://docs.hylang.org/en/stable/tutorial.html
Or if you think I am crazy for suggestion this you can always tell me in the comments, however if this is in any way useful, I appreciate votes.
Going to be honest, I'd prefer pure python to this :P It just looks uglier with all the () required. As well as the dictionaries they seem very strange, I can't just go to a spot and know what's key and what's value if both are strings unlike a regular dictionary.
Well I think that is a fairly normal reaction, but the syntax does give you some extra benefits, macros are very simple since the AST is the same as the syntax (okay that is only really true for a "real" lisp).
But one real benefit this gives is that you can use more functional style programming with hy, and it is compatible with both python 2 and python 3, and it really supports all the libraries you can use in python.
I see a lot of benefits :)