On Fri, 3 Sep 2010 21:16:13 +1000 Nick Coghlan <ncogh...@gmail.com> wrote: > On Fri, Sep 3, 2010 at 8:56 PM, Antoine Pitrou <solip...@pitrou.net> wrote: > > On Fri, 3 Sep 2010 20:44:01 +1000 Nick Coghlan <ncogh...@gmail.com> wrote: > > That's an interesting idea. I was planning to return a memoryview > > object (in order to hide the intermediate object, and make it really > > minimal), so perhaps the context protocol should be enabled on > > memoryviews? > > > > (__enter__ would be a no-op, and __exit__ would release the internal > > buffer and render it invalid, a bit like closing a file) > > Yep, sounds good (with "no-op" in this case meaning "just return self").
It just occurred to me that it could be interpreted as a breach of the moratorium. On the other hand, according to PEP 3003: “The case for adding a method to a built-in object can be made.” This case seems even lighter than adding a new method. Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com