A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-July/026088.html below:

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

[Python-Dev] Silent Deprecation Candidate -- buffer()M.-A. Lemburg mal@lemburg.com
Mon, 01 Jul 2002 21:59:29 +0200
Fredrik Lundh wrote:
> 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? 

As I said, I wrap binary data in buffer objects; these can
be memory-mapped files, strings containing binary data or
any other Python object implementing the buffer interface.

IMHO, buffer() is the only way to signify non-string data
while maintaining a string like interface.

> 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__(...)

Provided these return buffer objects, yes.

>     class basestring(buffer):
>         ...
> 
>     class string(basestring):
>         ...
> 
>     class unicode(basestring):
>         ...

I don't see the simplification, though ;-)

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4