Python Forum
what does sys.byteorder() return for others?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what does sys.byteorder() return for others?
#1
documentation describes sys.byteorder() as returning "little" for little-endian, and "big" for big-endian. what would it return for other byte orders like PDP-11 32-bit mode which is neither of those?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
I guess the best way to know this is to purchase a PDP-11 and try.

Edit: in sysmodule.c, there is
#if PY_BIG_ENDIAN
    SET_SYS_FROM_STRING("byteorder",
                        PyUnicode_FromString("big"));
#else
    SET_SYS_FROM_STRING("byteorder",
                        PyUnicode_FromString("little"));
#endif
whereas PY_BIG_ENDIAN is defined in pyport.h
#ifdef WORDS_BIGENDIAN
#define PY_BIG_ENDIAN 1
#define PY_LITTLE_ENDIAN 0
#else
#define PY_BIG_ENDIAN 0
#define PY_LITTLE_ENDIAN 1
#endif
For WORDS_BIGENDIAN, it seems that you need to understand the cryptic 'configure' script. Apparently, there may be some error message if the endianness is undefined. Python may well not compile on such platforms.
Reply
#3
i don't think python has been ported to a PDP-11 or its 16-bit OS.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020