[Python-ideas] simplification pep-like thing
Aahz
aahz at pythoncraft.com
Fri Jan 26 19:16:30 CET 2007
On Fri, Jan 26, 2007, tomer filiba wrote:
>
> Default Simplification
> =====================
> All the built in types would grow a __simplify__ and __rebuild__
> methods, which would follow these guidelines:
>
> Primitive types (int, str, float, ...) are considered atomic.
>
> Composite types (I think 'complex' is the only type), are
> broken down into their components. For the complex type,
> that would be a tuple of (real, imaginary).
>
> Container types (tuples, lists, sets, dicts) represent themselves
> as tuples of items. For example, dicts would be simplified
> according to this pseudocode:
>
> def PyDict_Simplifiy(PyObject * self):
> return PyDictType, tuple(self.items())
>
> Built in types would be considered atomic. User-defined classes
> can be simplified into their metaclass, __bases__, and __dict__.
This seems to contradict the following:
> For instance, file objects are atomic; one serializer may be able to
> handle them, by storing them as (filename, file-mode, file-position),
> while another may not be, so it would raise an exception.
Where do files fit into all this?
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"I disrespectfully agree." --SJM
More information about the Python-ideas
mailing list