Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Tiny/small/minimalist Python?

Reply
Thread Tools

Tiny/small/minimalist Python?

 
 
rtk
Guest
Posts: n/a
 
      07-01-2007
I'm looking for information on building a tiny/small/minimalist/
vanilla python interpreter. One that implements the core language and
a few of the key modules but isn't tied to any specific operating
system.

I guess I'm asking for the smallest subset of the standard Python
source code files that is necessary to get a working interpreter using
a plain C compiler.

Is this even possible? If so, has someone done it already? I've
looked on Google and in comp.lang.python but nothing comes up.

Thanks!
Ron

 
Reply With Quote
 
 
 
 
Terry Reedy
Guest
Posts: n/a
 
      07-02-2007

"rtk" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
| I'm looking for information on building a tiny/small/minimalist/
| vanilla python interpreter. One that implements the core language and
| a few of the key modules but isn't tied to any specific operating
| system.
|
| I guess I'm asking for the smallest subset of the standard Python
| source code files that is necessary to get a working interpreter using
| a plain C compiler.
|
| Is this even possible? If so, has someone done it already? I've
| looked on Google and in comp.lang.python but nothing comes up.

Google 'tinypython' and first entry is Mark Hammond's answer to nearly same
question. And some other responses might help you



 
Reply With Quote
 
 
 
 
Cameron Laird
Guest
Posts: n/a
 
      07-02-2007
In article <(E-Mail Removed) .com>,
rtk <(E-Mail Removed)> wrote:
>I'm looking for information on building a tiny/small/minimalist/
>vanilla python interpreter. One that implements the core language and
>a few of the key modules but isn't tied to any specific operating
>system.
>
>I guess I'm asking for the smallest subset of the standard Python
>source code files that is necessary to get a working interpreter using
>a plain C compiler.
>
>Is this even possible? If so, has someone done it already? I've
>looked on Google and in comp.lang.python but nothing comes up.

.
.
.
Tiny Python, PyMite, EmbeddedPython, Diet Python, deeply embedded
python, ...--I need to write up a page that explains these.
 
Reply With Quote
 
Campbell Barton
Guest
Posts: n/a
 
      07-02-2007
Cameron Laird wrote:
> In article <(E-Mail Removed) .com>,
> rtk <(E-Mail Removed)> wrote:
>> I'm looking for information on building a tiny/small/minimalist/
>> vanilla python interpreter. One that implements the core language and
>> a few of the key modules but isn't tied to any specific operating
>> system.
>>
>> I guess I'm asking for the smallest subset of the standard Python
>> source code files that is necessary to get a working interpreter using
>> a plain C compiler.
>>
>> Is this even possible? If so, has someone done it already? I've
>> looked on Google and in comp.lang.python but nothing comes up.

> .
> .
> .
> Tiny Python, PyMite, EmbeddedPython, Diet Python, deeply embedded
> python, ...--I need to write up a page that explains these.


Python binary/exe its self dosnt include much. if you get the full build
and just remove modules, you can strip a lot out.. scripts that try
import those files just wont work.
 
Reply With Quote
 
Paul Rubin
Guest
Posts: n/a
 
      07-02-2007
rtk <(E-Mail Removed)> writes:
> I'm looking for information on building a tiny/small/minimalist/
> vanilla python interpreter. One that implements the core language and
> a few of the key modules but isn't tied to any specific operating
> system.


You've gotten good suggestions about Python configurations. Depending
on your application you might look at alternative languages as well.
Lua and Hedgehog Lisp both come to mind as small embedded interpreters.
 
Reply With Quote
 
rtk
Guest
Posts: n/a
 
      07-02-2007
On Jul 1, 10:12 pm, Paul Rubin <http://(E-Mail Removed)> wrote:
> You've gotten good suggestions about Python configurations. Depending
> on your application you might look at alternative languages as well.
> Lua and Hedgehog Lisp both come to mind as small embedded interpreters.


PyMite will get a closer look from me eventually but I found that Lua
will fit my immediate needs quite nicely. Thanks for the suggestion.

FYI.. I wanted a simple version of Python to run on an ancient DEC
Alpha box. I got VMS Python 2.5 up and running but it is too slow to
use. It takes *minutes* to get the interpreter prompt after typing
'python'! Lua, on the other hand, compiled without changes (used the
ANSI switch) and runs nicely. I'm always up for learning a new
language anyway.

Ron

 
Reply With Quote
 
Paul Rubin
Guest
Posts: n/a
 
      07-02-2007
rtk <(E-Mail Removed)> writes:
> FYI.. I wanted a simple version of Python to run on an ancient DEC
> Alpha box. I got VMS Python 2.5 up and running but it is too slow to
> use. It takes *minutes* to get the interpreter prompt after typing
> 'python'!


Something is wrong. Maybe it's trying to DNS itself and timing out,
or something like that.
 
Reply With Quote
 
rtk
Guest
Posts: n/a
 
      07-02-2007
On Jul 2, 9:43 am, Paul Rubin <http://(E-Mail Removed)> wrote:
> rtk <(E-Mail Removed)> writes:
> > FYI.. I wanted a simple version of Python to run on an ancient DEC
> > Alpha box. I got VMS Python 2.5 up and running but it is too slow to
> > use. It takes *minutes* to get the interpreter prompt after typing
> > 'python'!

>
> Something is wrong. Maybe it's trying to DNS itself and timing out,
> or something like that.


The trouble is that the Alpha is too old. VMS Python is compiled for
a newer machine with a different instruction set and the Alpha is
emulating the machine instructions it does not have (a nice feature of
OpenVMS, but of dubious value).

For my needs, the effort of recompiling all of Python wasn't worth
it. Since Lua runs under Unix it will be perfect for my project. I'm
writing a compiler for a simple language to 6502 assembly code. I've
already written one in Python for small PIC microcontrollers (see PIC0
at http://www.geocities.com/oneelkruns/) and was planning on using
Python for this compiler project as well but it will be fun to use
something new, too. I am thinking of doing most of the development in
OpenVMS, just for the heck of it.

Ron

 
Reply With Quote
 
Irmen de Jong
Guest
Posts: n/a
 
      07-03-2007
Paul Rubin wrote:
> rtk <(E-Mail Removed)> writes:
>> FYI.. I wanted a simple version of Python to run on an ancient DEC
>> Alpha box. I got VMS Python 2.5 up and running but it is too slow to
>> use. It takes *minutes* to get the interpreter prompt after typing
>> 'python'!

>
> Something is wrong. Maybe it's trying to DNS itself and timing out,
> or something like that.


Something is definately wrong.

Back in the days my port of Python to the Commodore Amiga machine ran
quite comfortably on a 50 mhz CPU with 4 Mb of RAM. (ok ok it was
Python 1.5.2, that has to be said).
Python started in about 5 seconds on that Amiga if I remember
correctly. I'm quite sure your 'ancient' DEC Alpha box is way more
powerful than my Amiga back then.

--Irmen
 
Reply With Quote
 
rtk
Guest
Posts: n/a
 
      07-03-2007
On Jul 2, 6:26 pm, Irmen de Jong <(E-Mail Removed)> wrote:
> Back in the days my port of Python to the Commodore Amiga machine ran
> quite comfortably on a 50 mhz CPU with 4 Mb of RAM. (ok ok it was
> Python 1.5.2, that has to be said).
> Python started in about 5 seconds on that Amiga if I remember
> correctly. I'm quite sure your 'ancient' DEC Alpha box is way more
> powerful than my Amiga back then.


Yes, I agree (the box in question is an AlphaServer 1000 4/200), but
the killer is the fact that the Alpha is emulating *machine
instructions* that are part of the Python image which are not part of
the instruction set of that Alpha. That's what kills performance.
When I asked about it on the VMS Python forum I was told to give my
Alpha to a museum and get a more powerful machine

I did look briefly at Python 1.5.2, since it is simpler, but I'm
taking the trouble I've had as an excuse to learn a new language. So
far, I'm liking Lua, save the big pet peeve of starting indices at 1
and not 0 as all sane people do. I'm currently using Python quite a
bit for other projects, so it won't be neglected.

Ron

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments