A small Howto for the usage of Python-Xtra with Macromedia Director 7
or 8 for Win32 can be found at
. . . m e t a - w a r e . . . . . . . .
dr. janos bekesi
A--1050 Wien Tel. +43 1 548 2788
Austria Tel./Fax +43 1 548 1595
Python Module for libpcap packet capture library
This is a python module for the libpcap packet capture library, based on
the original PY-libpcap module by Aaron Rhodes. This new module uses
SWIG shadow classes to make the interface more OO
License: BSD Style
Requires: libpcap library
David Margrave (davidma(a)eskimo.com)
<a href="http://pylibpcap.sourceforge.net">Pylibpcap 0.2</a> -- Python
Module for libpcap packet capture library
Python-dev summary, January 1-15, 2001
To comment on material in this python-dev summary, you can simply post
to comp.lang.python / <python-list(a)python.org>. These summaries are
archived at <URL:http://www.amk.ca/python/dev/>.
Heading for 2.1alpha1
The pace of checkins has been steadily increasing in preparation for
the release of the first alpha of Python 2.1, still scheduled for
Friday, January 19 (but don't be surprised if it's a few days late).
The following PEPs had their implementations committed: PEP 208,
"Reworking the Coercion Model"; PEP 230, "Warning Framework"; PEP 232,
"Function Attributes". PEP 222, "Web Library Enhancements", has been
abandoned, or at least deferred to some future Python release.
Speeding up file.readline()
Improving the speed of line-by-line file access generated the most
discussion during this period.
New users wanting to compare Python and Perl often try the benchmark
of writing simple loops in both languages to read all the lines in the
file. Python 2.0 comes out slower in this test, but no one had ever
looked into the cause. As a datapoint, Tim Peters measured a "while
1: line = file.readline()" loop at 30 seconds on Windows, while a Perl
loop took 6 seconds, for a factor of 7 difference; the numbers are
somewhat better on most Unix machines, but Python is still
This benchmark came up for discussion in comp.lang.python. The
python-dev discussion started with a patch submitted by Jeff Epler
that added an xreadlines() function, analogous to xrange(), so you
could write "for line in file.xreadlines(): ...". "The desire is to
iterate over file contents in a way that satisfies the following
criteria: * Uses the 'for' syntax, because this clearly captures the
underlying operation. (files can be viewed as sequences of lines when
appropriate) * Consumes small amounts of memory even when the file
contents are large. * Has the lowest overhead that can reasonably be
Many false paths were followed in the resulting lengthy threads. I
don't propose to summarize every single red herring, but will instead
jump right to the conclusions.
The loop inside Python's readline() function is a straightforward
while loop using getc(). In multithreaded environments, getc() has to
lock the file object, and this adds additional overhead. On Windows
the overhead is startling: "It looks like we're paying (on Win98SE)
17 seconds for compiling with _MT (threadsafe libc)
6 seconds to do the work <wink>
5 seconds for "other stuff", best guess mostly a poor
2 seconds for not optimizing the loop
Perl is fast because it accesses the internals of C's FILE objects,
accessing the stream's buffers directly. The problem is that this is
nonportable and, as Tim Peters discovered, complicated: "20 years ago
I may have thought this was fun. I thought debugging large systems of
m4 macros was fun then, and I'm not sure this is either better or
worse than that -- well, it's worse, because I understood m4's
Windows has very high locking overhead for some reason, but this
overhead is still present on Unix platforms. The Single Unix
Specification includes a getc_unlocked() function that does no locking
and saves this overhead; the flockfile() and funlockfile() functions
can be used to lock the stream outside of an inner loop. Most Unix
platforms seem to gain an improvement of a factor of 4 or so, but Mark
Favas reported an extreme value: Tru64, the simple while loop went
from 322 seconds to 10 seconds, a factor of 32.
Windows doesn't have a getc_unlocked(), so a different solution needs
to be used there. Tim came up with a scheme using fgets(); fgets on
its own isn't suitable for reading lines, because there's no way to
detect embedded nulls, but you can fill a buffer with non-null bytes,
read a line into the buffer, and then search from the left for a
newline. "Surprise? Despite all the memsets, memchrs (looking for a
newline), and one-at-a-time backward searches (looking for a null
byte), it's a huge win on Windows." The simple while loop went from
30 seconds to 13 seconds.
Some improvements were also made to the fileinput module, and Jeff
Epler's xreadlines module was added, with the right glue to add an
.xreadlines() method to file objects that automatically imports the
module. 'for line in file.xreadlines()' usually takes about half the
time of the simple while loop.
Therefore, Python 2.1 will have significantly faster file I/O for the
common task of processing a file line-by-line.
Ka-Ping Yee announced pydoc, a tool for browsing the python
documentation: "At the shell prompt, 'pydoc <name>' displays
documentation on <name>, very much like 'man'." ?!ng posted a sample
transcript of pydoc in action:
It's been checked into the sandbox area of the CVS tree:
Try it out! The more favorable reaction to pydoc and the more testing
it gets, the better the chance of it slipping into 2.1.
Exporting names from a module
Patch #102808 adds a mechanism to export names from a module. GvR's
description: "... if there's a variable __exports__ in the module, it
is a list of identifiers, and any access from outside the module to
names not in the list is disallowed. This affects access using the
getattr and setattr protocols (which raise AttributeError for
disallowed names), as well as "from M import v" (which raises
Reactions were mixed. Some people liked the idea, and thought it
would make some additional optimizations possible. To quote Neil
Schemenauer, "It should allow some attribute access inside of modules
to become faster (like LOAD_FAST for locals). I think that
optimization could be implemented without too much difficulty." Other
people thought that applying it only to modules would cause people to
assume that it would also work for classes, but the patch didn't
The final decision was to reject the patch. However, one part of the
patch was added; 'from Module import *' will now look for a variable
named __all__ containing a list of strings, and will only import the
symbols listed in __all__.
Christian Tismer released a set of Stackless Python patches for 2.0.
Note that a bugfix release was made on January 15th.
Michel Pelletier has written a draft PEP for adding interfaces to
Python. No PEP number has been allocated yet.
Python project page on SourceForge:
Python Enhancement Proposals (PEPs):
I am happy to announce the release of Jython 2.0.
Jython is a Java implementation of the Python programming
language. It allows users to compile Python source code to
Java byte codes, and run the resulting bytecodes on any Java
Virtual Machine. It is a very seamless and smooth
integration with Java: from Python you have complete access
to all Java libraries, can build applets, can integrate with
Java beans, and can subclass Java classes in Python and vice
versa. Like Python, and unlike Java, Jython can also be
used interactively: just type some Jython code at the
prompt and see the results immediately.
A java installer is available for download at the Jython website:
Installation is started by running the installer class. Further
information and tips on installation is available at:
Jython 2.0 is feature compatible with Python 2.0 and among the
new feature are:
- Augmented assignment, e.g. x += 1
- List comprehensions, e.g. [x**2 for x in range(10)]
- Extended import statement, e.g. import Module as Name
- Extended print statement, e.g. print >> file, "Hello"
A complete list of changes and differences are available here:
Bugs can be reported to the bug manager on SourceForge:
A python wrapper for sendmail's libmilter functionality.
This is a C wrapper around sendmail's libmilter functionality to
implement a python module. With this module, you can have sendmail
events (connect, helo, headers, etc) directly run your python code as
they occur. Your code can also direct sendmail to change headers, modify
the message body, etc.
This is a beta version, and my first python extension. I'd appreciate
any information, requests, comments, critique, and patches ;-) Email me
Requires: sendmail-8.11.1 or above
Jim Niemira (urmane(a)urmane.org)
<a href="http://www.urmane.org/~urmane/milter">Milter/0.1</a> -- A
python wrapper for sendmail's libmilter functionality.
*** CALL FOR PARTICIPATION ***
O'Reilly Open Source Convention
July 23-27, 2001
San Diego, California
*** Python Track ***
O'Reilly & Associates is pleased to announce the 3rd annual Open
Source Convention. This event is the central gathering place for the
Open Source community to exchange ideas, techniques, and to advance
the language. The Open Source Convention is a five-day event designed
for programmers, developers, and technical staff involved in Open
Source technology and its applications. The convention will be held at
the Sheraton San Diego Hotel and Marina, San Diego, California, July
The program committee of the Python track invites submissions of
tutorial and convention presentation on topics of interest to
The first two days of the convention are devoted to tutorials.
Tutorial proposals must include the following:
- Tutorial length (3 or 6 hours)
- Target audience including any recommended prerequisites.
- What attendees will learn.
- Tutorial outline--a short bullet list description of the
- Speaker name
- Speaker biography
- Complete speaker contact information.
The program committee particularly encourages the submission of
tutorials that are designed to present core Python topics to a
technically sophisticated audience (i.e., tutorials should favor
technical depth versus advocacy and high-level overviews).
Convention proposals will be considered for the following types of
- Focused discussions related to a specific Python technology or
programming technique. Typical examples might include
extension building, internationalization, programming with
threads, Tkinter, and XML.
- New product/technology demonstrations.
- Panel discussions.
- Applications and case studies that describe the use of Python
in real-world applications.
Convention proposals must include the following:
- Type of talk -- technology, new product, panel, or case-study.
- Title of talk or demonstration.
- Abstract of talk, maximum of 250 words.
- Speaker name.
- Speaker biography.
- Complete speaker contact information.
Submissions of novel and unusual Python applications are particularly
encouraged. Presentations by marketing staff or with a marketing
focus will not be accepted.
Submitting Your Proposal
All proposals must be sent to oscon2001-proposals(a)oreilly.com
Proposals should be sent in plain text with no attachments. Submit one
proposal per email. The subject line of your email must follow this
Last name: proposal type: proposal title
Johnson: Tutorial: Advanced Python Programming
You will receive an automatic confirmation upon receipt of each
Tutorial and presentation proposals due: February 1, 2001
Notification to presenters : March 1, 2001
Tutorial presentations due : May 1, 2001
Convention presentations due : June 1, 2001
More information about the convention can be found at:
Specific questions concerning the Python track can be sent to
Python Track Program Committee
Andrew Kuchling, MEMS Exchange
Andy Robinson, ReportLab
David Ascher, ActiveState
Paul Dubois, Lawrence Livermore National Laboratory
David Beazley, University of Chicago, Chair
Fredrik Lundh, Secret Labs AB/PythonWare
Greg Stein, Technical Advisor, ActiveState
Jason Asbahr, Origin/Electronic Arts
Jeremy Hylton, Digital Creations
Tim Peters, Digital Creations
Guido van Rossum, Digital Creations
Version 0.2 of the Quixote Web development toolkit is now available.
Quixote uses Python package to store all the code and HTML for a
Web-based application. PTL, Python Template Language, is used to mix
HTML with Python code; the basic syntax looks just like Python, but
expressions are converted to strings and appended to the output.
Notable changes in this version are: handler methods are now passed a
single 'request' object, and not a request,response pair; added a
config parser, so that Individual Quixote applications can have their
own configuration settings; the session management has been
overhauled; PTL modules can now have docstrings; and other various
minor bug fixes and enhancements.
Some of these changes, especially the first one, are incompatible with
the previously released version, so existing code will have to be
rewritten to work with this version.
The Quixote home page is at:
The code can be downloaded from:
Thanks to Neil Schemenauer, who did most of the packaging of this
release, and to the various developers at the MEMS Exchange who've
contributed to this release.
FOR IMMEDIATE RELEASE
KAIVO ANNOUNCES PYTHON TRAINING PARTNERSHIP
DENVER (Jan. 16, 2001) - Kaivo, a leading Open Source solutions provider, announced that
they will be partnering with Mark Lutz, one of the primary figures in the Python community, in the delivery of Python education and training.
The three day course, "Python for Programmers" is an in-depth, hands-on introduction to the Python programming / scripting language. Students will learn Python language fundamentals as well as how to apply Python in a handful of common application domains, such as
Internet scripting, systems programming, and user interface development. "Python for
Programmers" has been successfully presented to both programming experts and novices. Therefore there are no absolute prerequisites for it other than basic computer familiarity. Some prior background in programming may help for later topics, but is not generally required.
The first course will be offered February 21 to 23 in Denver, CO. Detailed course information and on-line registration is available at http://www.kaivo.com/KaivoCourses/catalog or call Kaivo at 303-539-0200 and ask for a training coordinator. Kaivo plans to co-sponsor future classes, in Denver as well as other parts of the country-check www.kaivo.com for periodic updates to the schedule.
"Our customers and potential customers are constantly requesting Python training," said
Kathy Gosa, Kaivo's vice president of education. "The extremely rapid growth of the Python community has driven us to provide the best training possible. We are very excited to be partnering with someone of Mark's expertise."
Mark Lutz is a Python trainer, writer, and software developer, and is one of the primary figures
in the Python community. He is the author of the O'Reilly books "Programming Python" and "Python Pocket Reference" and co-author of "Learning Python". Mark has been involved with Python since 1992, and began teaching Python classes in 1997.
"I'm excited to be working with Kaivo," said Lutz, "especially due to their experience with open systems and open source. I think their co-sponsoring of this class and future classes indicates the continuing rapid growth of Python adoption."
Kaivo began as a UNIX education and training provider in 1984. We have been educating customers on the benefits and power of Open Systems and Open Source tools for sixteen years. That experience has taught us how important technical training can be to the rapid adoption and successful implementation of a powerful tool like Python.
Python is a popular object-oriented scripting language, used for a wide variety of
programming tasks. Visit www.python.org for more information, and to download the most current Python release free.
# # #