Extending built-in language (Win 95)
Martin von Loewis
loewis at informatik.hu-berlin.de
Mon Apr 10 09:33:02 EDT 2000
Mark Pope <M_Pope at shef.rage.co.uk> writes:
> I would like to extend the objects available in python, however It is not
> appropriate to build normal extension dll's.
Why is it not appropriate? It works perfectly well to add new types in
an extension module. Many extensions do.
> Appears to be a template for defining new built in objects which will be
> compiled into the Python static lib. However there must be other steps to
> making the new object reachable from python script.
The new type becomes only available by means of creation of
values. Look at the file type. Do you write
f = file('foo.txt','w')
? No, you use open() instead, which just returns an instance of a file
object. In the xxmodule, xx_new is used to make new instances, which
can be called from Python as xx.new().
Hope this helps,
Martin
More information about the Python-list
mailing list