Does Python provide "Struct" data structure?

Daniel Mark danielmarkhot at gmail.com
Fri Sep 22 10:56:21 EDT 2006


Hello all:

I have found a useful module in IPython, named 'from IPython.ipstruct
import Struct".

So I can use it as follows:

####################################
from IPython.ipstruct import Struct

mystruct = Struct(echo = 1,
                      verb = 'Verbose',
                      filedir = 'C:/temp',
                      )

print mystruct.filedir
#####################################

I have two following questions:

1> Does Python provide such Struct in this standard libary.
Python has "4.3 struct -- Interpret strings as packed binary data", but
it looks like different
from what I really want to get.

2> Is it safe to use IPython's modules in my python program?
I will pack all my code into an executable application by using py2exe.
The clients would like to use this application without any python
intallation.
What should I pay attention if I include the IPython modules into my
python code and
convert it into executable application by using py2exe?

The setup.py for my application is as follows:
###########################################
from distutils.core import setup
import py2exe

options = {
    "bundle_files": 1,
    # "ascii": 1, # to make a smaller executable, don't include the
encodings
    "compressed": 1, # compress the library archive
    }

setup(
    # The first three parameters are not required, if at least a
    # 'version' is given, then a versioninfo resource is built from
    # them and added to the executables.
    version = "1.0",
    description = "mycode",
    name = "mycode",

    options = {"py2exe": options},
    zipfile = None, # append zip-archive to the executable.

    # targets to build
    console=['mycode.py'],
  )
###################################################

Does I need to make any modification if I include IPython module in my
code?

Thank you for your helps
-Daniel




More information about the Python-list mailing list