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

struct: per item endianess specification #48734

Closed
shaddybaddah mannequin opened this issue Dec 2, 2008 · 4 comments
Closed

struct: per item endianess specification #48734

shaddybaddah mannequin opened this issue Dec 2, 2008 · 4 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@shaddybaddah
Copy link
Mannequin

shaddybaddah mannequin commented Dec 2, 2008

BPO 4484
Nosy @rhettinger, @mdickinson, @shaddybaddah

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2010-04-07.21:39:46.016>
created_at = <Date 2008-12-02.06:26:43.255>
labels = ['type-feature', 'library']
title = 'struct: per item endianess specification'
updated_at = <Date 2010-04-07.22:06:36.693>
user = 'https://github.com/shaddybaddah'

bugs.python.org fields:

activity = <Date 2010-04-07.22:06:36.693>
actor = 'rhettinger'
assignee = 'none'
closed = True
closed_date = <Date 2010-04-07.21:39:46.016>
closer = 'mark.dickinson'
components = ['Library (Lib)']
creation = <Date 2008-12-02.06:26:43.255>
creator = 'da4an1qu1'
dependencies = []
files = []
hgrepos = []
issue_num = 4484
keywords = []
message_count = 4.0
messages = ['76726', '102566', '102568', '102570']
nosy_count = 4.0
nosy_names = ['rhettinger', 'mark.dickinson', 'da4an1qu1', 'neologix']
pr_nums = []
priority = 'normal'
resolution = 'rejected'
stage = None
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue4484'
versions = ['Python 2.6']

@shaddybaddah
Copy link
Mannequin Author

shaddybaddah mannequin commented Dec 2, 2008

I note that using the struct module, a user can specify if number items
of the format are to be interpreted as either big or small endian.
However the format specifier can only accept one indicator character at
its first character to apply for all number items in it. e.g:

"<HI" specifies that both the unsigned short and unsigned int are to be
interpreted as little endian values.

It would be nice to be able to instead do "<>HI" where the first '<'
character indicates the default endianess (for compatibility purposes)
and then the second '>' character indicates that the unsigned short
should be interpreted as big endian. The unsigned int defaults to small
endian as per the first character.

@shaddybaddah shaddybaddah mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Dec 2, 2008
@neologix
Copy link
Mannequin

neologix mannequin commented Apr 7, 2010

I don't see any reasonale reason for mixing endianess inside a struct, and don't know of any real-life protocol using per-item endianess.
Unless someone comes up with a good reason for doing so, and since no one else seems to be interested by this issue, I'd suggest to close it.

@mdickinson
Copy link
Member

I agree that this seems like something that would rarely be needed. If it's really necessary, it's possible to break up the format and do the packing/unpacking in fixed-endian pieces.

@rhettinger
Copy link
Contributor

FWIW, I concur with Mark and Charles-Francois.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants