[pycrypto] Once again: Python3 with PyCrypto
Thorsten Behrens
sbehrens at gmx.li
Mon Dec 27 09:58:50 CST 2010
On 12/27/2010 8:37 AM, Dwayne C. Litzenberger wrote:
> Wow, it looks like you're really moving things along.
I am. Right now, the tests run and fail. Going through the first batch,
it looks like it's all because of string/bytes things that need to be fixed.
I can use your input here, as I have two options with the way I resolve
these issues:
Option 1:
Use helper functions instead of built-ins. Helper functions are used
where binary data was intended. For example, ord(x) becomes bord(x),
which returns ord(x) on 2.x and x on 3.x
Advantage: Explicit control. Where ord(x) on a text string was truly
meant, it can still be called. Nothing unexpected will happen.
Disadvantage: Need to use the helper functions where before you could
use a built-in
Option 2:
Assign ord = int if Python 3.x is detected.
Advantage: No code changes for ord, things just work.
Disadvantage: Potential side-effects that would be very hard to track
down. Also, wouldn't be consistent with how we need to handle other
things such as literals, where b('x') is the only option.
I am favoring Option 1, heavily. But before I change the code
accordingly, I'd like to know you're good with the proposal.
Thorsten
More information about the pycrypto
mailing list