[Python-Dev] Silent Deprecation Candidate -- buffer()

Fredrik Lundh fredrik@pythonware.com
Mon, 1 Jul 2002 16:57:00 +0200


mal wrote:

> > does anyone have any real-life use cases?  I've never been
> > able to use it for anything, and cannot recall ever seeing it
> > being used by anyone else...
 
> I use it in real-life applications to wrap binary data.

can you elaborate?  how do you use it?  could it be replaced
by something simpler, and still work in your application?

would something like this work?

    class buffer(object):
        def __len__(...)
        def __getitem__(...)
        def __getslice__(...)

    class basestring(buffer):
        ...

    class string(basestring):
        ...

    class unicode(basestring):
        ...

</F>