[Python-Dev] Minipython

"Martin v. Löwis" martin at v.loewis.de
Sun Sep 24 06:49:34 CEST 2006

Milan Krcmar schrieb:
> Can you give me any information to start with? I would prefer stripping
> current version of Python rather than returning to a years-old (but
> smaller) version and remembering what of the new syntax/functionality to
> avoid.

I would start with dropping support for dynamic loading of extension
modules, and link all necessary modules statically.

Then, do what Michael Hudson says: find out what is taking up space.

size */*.o|sort -n

should give a good starting point; on my system, I get

  29356    1416     156   30928    78d0 Objects/classobject.o
  30663       0       0   30663    77c7 Objects/unicodectype.o
  33530     480     536   34546    86f2 Python/Python-ast.o
  33624    1792     616   36032    8cc0 Objects/longobject.o
  36603      16     288   36907    902b Python/ceval.o
  36710    2532       0   39242    994a Modules/_sre.o
  39169    9473    1032   49674    c20a Objects/stringobject.o
  52965       0      36   53001    cf09 Python/compile.o
  66197    4592     436   71225   11639 Objects/typeobject.o
  74111    9779    1160   85050   14c3a Objects/unicodeobject.o

Michael already mentioned you can drop unicodeobject if you want
to. compile.o would also offer savings, but stripping it might
not be easy. Dropping _sre is quite easy. If you manage to
drop compile.o, then dropping Python-ast.o (along with the
rest of the compiler) should also be possible.
unicodectype will go away if the Unicode type goes, but can
probably be removed separately. And so on.

When you come to a solution that satisfies your needs,
don't forget to document it somewhere.


More information about the Python-Dev mailing list