Kinda, however there are a few superior items to the bit syntax:
* In Erlang, the bindings are in the expression itself (whether packing or unpacking) which makes the correspondance easier.
* Because the bindings are embedded and set left to right, it becomes possible to use one binding as parameter to the next pattern e.g. `L:3, D:L/binary` will first parse 3 bits as an unsigned integer L, then extract the next L bytes as a binary substring.
* Also Erlang's bit syntax can do sub-byte matching, I don't think python's struct can.
* And Erlang's bit syntax is much clearer and orthogonal (modulo knowing the — convenient — defaults) e.g. where extracting a little-endian 32-bit signed integer with struct is "<i" with Erlang it's :32/integer-signed-little (32 units, integer, signed, little-endian; the default unit size for integers is the bit). More verbose, but also completely explicit and more flexible, and very easy to change.
[1] https://rwmj.wordpress.com/2010/02/03/on-the-awesomeness-of-...
That Erlang syntax reminds of the python 'struct' [0], except it's generating the unpacking logic at compile time, am I right? Yes that is indeed very cool - it doesn't even seem that hard to do I'd wonder why other languages don't have a similar facility!
[0] https://docs.python.org/2/library/struct.html