Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python runtime: bytes comprehension #396

Closed
arekbulski opened this issue Mar 28, 2018 · 2 comments
Closed

Python runtime: bytes comprehension #396

arekbulski opened this issue Mar 28, 2018 · 2 comments

Comments

@arekbulski
Copy link
Member

I am too busy with other work so I am leaving this work item. I am implementing ProcessXor in Construct and found that this code

        if PY2:
            return bytes(bytearray(v ^ key for v in bytearray(data)))
        else:
            return bytes(v ^ key for v in data)

could easily be

            return bytes(v ^ key for v in data)

because bytes([1,2,3]) works on Python 2 as well.

@GreyCat
Copy link
Member

GreyCat commented Mar 28, 2018

@dgladkov did some benchmarks previously: kaitai-io/kaitai_struct_python_runtime#8 and claimed that it was the optimal solution.

@arekbulski
Copy link
Member Author

Okay, then I will withdraw this and focus on more important work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants