Hacker News new | past | comments | ask | show | jobs | submit login

This type of work is much easier in Python 3.



It's still very cumbersome, especially compared with state of the art. You may want to look at how it works in Erlang.


Erlang's binary matching is beyond awesome, and OCaml has a pretty good implementation of it as well (Bitstring) [1].

Cool thing about Elixir is of course that awesome Erlang binary handling is available and very easy to use.

Lots of people have been lobbying for something like this in Rust, given its low-level orientation, but there's been resistance to the idea from the core devs, who want it to be done using syntax extension.

1. https://rwmj.wordpress.com/2010/02/03/on-the-awesomeness-of-...


Agreed. I remember unpacking binary data in Python 2.7 during my late undergrad and found it much more cumbersome. I bookmarked the article in celebration the next time I'm doing something like that again.


All python 3 does is add an onion layer around unicode. Fortunately it looks like these techniques will work for python 2.7 or 3.x. With 2.7 obviously being the preference for pretty much everyone who isn't a python 3 developer.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: