Mavnn's blog

Stuff from my brain

We're running Cloud Native .NET in Brighton, 26th-27th April 2018. High quality training for building .NET Core, distributed, production ready systems.

What’s New in Python 2.7... Hurts My Brain.

PEP 3137: The memoryview Object

The memoryview object provides a view of another object’s memory content that matches the bytes type’s interface.

…snip example code…

The content of the view can be converted to a string of bytes or a list of integers:

…snip example code…

memoryview objects allow modifying the underlying object if it’s a mutable object.

See also

PEP 3137 - Immutable Bytes and Mutable Buffer
PEP written by Guido van Rossum. Implemented by Travis Oliphant, Antoine Pitrou and others. Backported to 2.7 by Antoine Pitrou; issue 2396.

This. This makes my brain hurt.