tomerfiliba / construct3 Goto Github PK
View Code? Open in Web Editor NEWConstruct3: Binary Packing Combinators
Home Page: http://construct.readthedocs.org
License: MIT License
Construct3: Binary Packing Combinators
Home Page: http://construct.readthedocs.org
License: MIT License
When importing construct3, I get an exception due to a missing construct3/lib/containers.py file:
$ python -c 'import construct3'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "construct3/__init__.py", line 3, in <module>
from construct3.packers import (Packer, PackerError, Adapter, Struct, NamedPacker, Raw, Range, Bitwise,
File "construct3/packers.py", line 4, in <module>
from construct3.lib.containers import Container
ImportError: No module named containers
Copying the construct/lib/container.py file from the construct 2 repository fixes the issue, but I'm guessing you have a file that simply hasn't been added to the repository.
I've tried to use If,
with no much success
see:
fruch/construct3@77532b6
Maybe I should have written this to the user-group, but sorry, I don't like user groups :-)
I'm very impressed by construct3, and it's a pity that I didn't hear about construct1 and construct2 before. It would have saved me and my colleagues a ton of work a year ago.
But allow me to quote The Zen of Python:
There should be one-- and preferably only one --obvious way to do it.
I think this is a very important rule of API design. When you have aliases and multiple syntaxes to accomplish the same thing things get confusing.
For example byte
, int8u
and int8ul
mean the same, right? At the same time int8
, int8s
, int8l
and int8sl
are the same thing as well. You might disagree with me, but I think that's "too many ways to do it".
(Not mentioning that unsigned int8 is usually called uint8
, not int8u
).
You have a couple of syntax shortcuts as well: byte[4]
for Array(4, byte)
, 'a' / byte
for ('a', byte)
, and byte >> byte
for Struct(byte, byte)
. IMHO those are unnecessary. Compare:
'a' / byte >> 'b' / byte >> 'c' / byte >> 'd' / byte
Struct(('a', int8u), ('b', int8u), ('c', int8u), ('d', int8u))
The later one is only marginally longer, but how much more readable to me.
Anyway, I think construct3 is fantastic, great work! I'm sure it's impossible to spoil it—that's how good it is :-)
Something like Pass from construct 2.5 is missing,
especially when If takes 3 args
(cond, then, else)
I noticed that the organization account doesnt have me as a member. Would you add me as a member?
Ping @tomerfiliba
After I took it over, I started doing some serious API changes. Most classes have been changed. Second half of my plan is going to be porting it to Cython.
I dont know how Construct3 is going but maybe we should consider having a debate on what the future of both projects should be. @tomerfiliba You could probably import some of the classes that I added.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.