[issue1023290] proposed struct module format code addition

2009-08-15 Thread Josiah Carlson
Josiah Carlson added the comment: I'm not a big fan of the names, but as long as the functionality exists, people can easily alias them as necessary. I've not actually looked at the patch, but as long as it does what it says it does, it looks good. My only question, does it makes sense to ba

[issue1023290] proposed struct module format code addition

2009-08-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: I agree with the comments which were made on the following points: - please use consistent naming (`as_bytes` / `from_bytes`, or `asbytes` / `frombytes`; my preference goes to the former, especially now that we have `bit_length`) - default byteorder should be na

[issue1023290] proposed struct module format code addition

2009-08-15 Thread Eric Eisner
Eric Eisner added the comment: Is there some pre-existing naming convention of as_X and fromX? It seems strange that two related functions would have a different use of underscores. -- nosy: +ede ___ Python tracker

[issue1023290] proposed struct module format code addition

2009-08-15 Thread Mark Dickinson
Mark Dickinson added the comment: Thanks for this patch, Alexandre! I'm +1 on applying a version of this patch. I'm not convinced that the variable-length part (i.e., fixed_length=None) of int.as_bytes is all that useful; the choices that need to be made about how to represent integers seem

[issue1023290] proposed struct module format code addition

2009-08-11 Thread Alexandre Vassalotti
Alexandre Vassalotti added the comment: I went ahead and coded a new API for converting long integers to byte arrays and vice-versa. My patch adds two new methods to the long type: .as_bytes() and .frombytes(). The patch itself is well-documented; but nevertheless, here's some examples: >>> (1

[issue1023290] proposed struct module format code addition

2008-07-05 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: Pickle is a solution only if you accept the target format to be opaque, which is not what you are looking for usually. Once again I just had to write the cumbersome: junk_len = 1024 junk = (("%%0%dX" % junk_len) % random.getrandbits(junk_len

[issue1023290] proposed struct module format code addition

2008-06-11 Thread Josiah Carlson
Josiah Carlson <[EMAIL PROTECTED]> added the comment: This isn't about packing arrays of long integers in an array. I know the discussion is old, and I know the discussion is long, and honestly, I don't really need this particular functionality anymore (in the struct module in particular), but I

[issue1023290] proposed struct module format code addition

2008-06-11 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: Don't think there is sufficient agreement on this one to move forward. It looks like OP has a completely different conception of the struct module than the other respondants. For the time being, pickle.dumps with protocol 2 can serve

[issue1023290] proposed struct module format code addition

2008-01-18 Thread Mark Dickinson
Mark Dickinson added the comment: See also issue #923643. -- nosy: +marketdickinson _ Tracker <[EMAIL PROTECTED]> _ ___ Python-bugs-l

[issue1023290] proposed struct module format code addition

2008-01-17 Thread Antoine Pitrou
Antoine Pitrou added the comment: FWIW, an use case of this I have encountered is to generate a string of random bytes from the long object returned by random.getrandbits(). -- nosy: +pitrou _ Tracker <[EMAIL PROTECTED]>

[issue1023290] proposed struct module format code addition

2007-09-19 Thread Brett Cannon
Changes by Brett Cannon: -- keywords: +patch _ Tracker <[EMAIL PROTECTED]> _ ___ Python-bugs-list mailing list Unsubscribe: http://