extended slices and buffer objects ????

Tim Peters tim.one at home.com
Fri Mar 2 13:46:59 EST 2001


[Mats Wichmann]
> Perhaps someone can shed light on my confusion about these two Python
> features?
>
> (1) Extended slicing.  I've seen claims that it's useful for
> "multidimensional data structures such as matrices and arrays", but my
> brain just isn't making sense of this. Can anyone give me a practical
> example or two?

Core Python makes no use of these.  They were added for the NumPy extension,
and that's where they're used.

> [2] Buffer objects.  What are buffer objects for, anyway? I find this
> description from the Reference Manual somewhat less than enlightening:
>
> Buffers are not directly supported by Python syntax, but can be
> created by calling the builtin function buffer().

They're a not-ready-for-prime-time generalization under the covers, seeking
to unify some aspects common to, e.g., processing strings and memory-mapped
files.  Ignore them for now!  This is still wizard-level stuff, and almost
wholly undocumented even in the internals.

By the way, you forgot to ask about the undocumented file.readinto() method
too <wink>.

if-buffer()-were-ready-for-prime-time-readinto()-would-be-documented-ly
    y'rs  - tim





More information about the Python-list mailing list