[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dld / Python?
> > 'Dynamic loading of modules is rumoured to be supported on some other
> > systems: [...], and Atari ST.'
> I guess they just quoted dld's readme (python can be linked with dld);
> dld had once been ported to the ST.
:-(. It would be nice if somebody with diskspace to spare would give
Python a try (needs about 10MB free space for docs/source/compilation and
configure etc. stuff). At the bottom is a blurb about Python features
for the interested. If I had enough space I would try it myself
(compiling >1MB of code could take a while on STfm :).
>From the atari version thread and GUI (built on C-stdwin / Tk) support
need to be dropped out. For leaving threads out there's a configure
option. After the compiler itself would have been ported, I could
myself give a try at converting the core parts of the stdwin module to
GEM or W... IMHO quite a worthwhile project! :)
My main interests lie in true OOP (not static like C++) capability,
and fast compile/running. I guess Python will need quite a bit of
memory, but probably less than C++. Here's an example of how to use
network from Python: :)
----
# Send UDP broadcast packets
MYPORT = 50000
import sys, time
from socket import *
s = socket(AF_INET, SOCK_DGRAM)
s.bind(('', 0))
s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
while 1:
data = `time.time()` + '\n'
s.sendto(data, ('<broadcast>', MYPORT))
time.sleep(2)
----
# Receive UDP packets transmitted by a broadcasting service
MYPORT = 50000
import sys
from socket import *
s = socket(AF_INET, SOCK_DGRAM)
s.bind(('', MYPORT))
while 1:
data, wherefrom = s.recvfrom(1500, 0)
sys.stderr.write(`wherefrom` + '\n')
sys.stdout.write(data)
----
For the C-sources and more info see: ftp.funet.fi:/pub/languages/python/.
I have understood Python to be more portable than eg. Perl.
- Eero
-----
What is Python?...
Python is a relatively new very-high-level language developed
in Amsterdam. Python is a simple, procedural language, with
features taken from ABC, Icon, Modula-3, and C/C++.
It's central goal is to provide the best of both worlds:
the dynamic nature of scripting languages like Perl/TCL/REXX,
but also support for general programming found in the more
traditional languages like Icon, C, Modula,...
As such, it can function as a scripting/extension language,
as a rapid prototyping language, and as a serious software
development language. Python is suitable for fast development
of large programs, but also does well at throw-away shell coding.
Python resembles other scripting languages a number of ways:
- dynamic, interpretive, interactive nature
- no explicit compile or link steps needed
- no type declarations (it's dynamically typed)
- high-level operators ('in', concatenation, etc)
- automatic memory allocation/deallocation (no 'pointers')
- high level objects: lists, tuples, strings, associative arrays
- programs can construct and execute program code using strings
- very fast edit/compile/run cycle; no static linking
- well-defined interface to and from C functions and data
- well-defined ways to add C modules to the system and language
Python's features that make it useful for serious programming:
- it's object-oriented; it has a simplified subset of
C++'s 'class' facility, made more useful by python's
dynamic typing; the language is object-oriented from
the ground up (rather than being an add-on, as in C++)
- it supports modules (imported packages, as in Modula-3);
modules replace C's 'include' files and linking, and allow
for multiple-module systems, code sharing, etc.;
- it has a good exception handling system (a 'try' statement,
and a 'raise' statement, with user-defined exceptions);
- it's orthogonal; everything is a first-class object in the
language (functions, modules, classes, class instance methods...)
and can be assigned/passed and used generically;
- it's fairly run-time secure; it does many run-time checks
like index-out-of-bounds, etc., that C usually doesn't;
- it has general data structuring support; Python lists are
heterogeneous, variable length, nestable, support slicing,
concatenation, etc., and come into existance and are reclaimed
automatically; strings and dictionaries are similarly general;
- it's got a symbolic debugger and profiler (written in python,
of course..), and an interactive command-line interface;
as in Lisp, you can enter code and test functions in isolation,
from the interactive command line (even linked C functions);
- it has a large library of built-in modules; it has support
for sockets, regular expressions, posix bindings, etc.
- it supports dynamic loading of C modules on many platforms;
- it has a _readable_ syntax; python code looks like normal
programming languages; tcl and perl can be very unreadable
(IMHO; what was that joke about Perl looking the same after
rot13..); python's syntax is simple, and statement based;
------