Algorithm for Python's pack function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prelude
    New Member
    • Nov 2008
    • 2

    Algorithm for Python's pack function

    I'm looking into how the Python's pack function is implemented. Does anyone know where the source is located? I grep the entire lib folder but couldn't find it. I have the unfortunate task of converting some python code which uses pack extensively into C++ :(
  • YarrOfDoom
    Recognized Expert Top Contributor
    • Aug 2007
    • 1243

    #2
    I believe that function is located in (starting from your python install folder): Lib/struct.pyc
    Which is, unfortunately, compiled python code. So you can't read it, unless you can find a python decompiler.

    Comment

    • prelude
      New Member
      • Nov 2008
      • 2

      #3
      Originally posted by YarrOfDoom
      I believe that function is located in (starting from your python install folder): Lib/struct.pyc
      Which is, unfortunately, compiled python code. So you can't read it, unless you can find a python decompiler.
      That's really unfortunately. Is there a better description what the function does other than what is given in the manual for struct module pack?

      Comment

      • oler1s
        Recognized Expert Contributor
        • Aug 2007
        • 671

        #4
        You could always download the Python source code. It is available on the website along with the binary installer.

        Comment

        Working...