GO Tools

Type Class Library: typelib.py

version 1.0 (2000-03-26)

Homepage: http://gotools.sourceforge.net (see sgflib.py)

Copyright (C) 2000 David John Goodger (mailto:goodger@python.org). typelib.py comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it and/or modify it under certain conditions; see the source code for details.


This library implements abstract superclasses to emulate Python's built-in data types. This is useful when you want a class which acts like a built-in type, but with added/modified behaviour (methods) and/or data (attributes).

Implemented types are: String, Tuple, List, Dictionary, Integer, Long, Float, Complex (along with their abstract superclasses).

All methods, including special overloading methods, are implemented for each type-emulation class. Instance data is stored internally in the data attribute (i.e., self.data). The type the class is emulating is stored in the class attribute self.TYPE (as given by the built-in type(class)). The SuperClass.__init__() method uses two class-specific methods to instantiate objects: _reset() and _convert().

See "sgflib.py" (at module's homepage, see above) for examples of use. The Node class is of particular interest: a modified Dictionary which is ordered and allows for offset-indexed retrieval.

Return to the Smart Game Format Parser Library main page

Return to the SGF Summarizer main page

Return to the Go Tools main page

Go Tools project page

Project administrator: David Goodger

page last updated: 2000-03-27

Hosted by SourceForge.net

123count.com : counter and tracker