Antoine Pitrou wrote: > Alexander Belopolsky <alexander.belopolsky <at> gmail.com> writes: >> I did not follow numpy development for the last year or more, so I >> won't qualify as "the numpy folks," but my understanding is that numpy >> does exactly what Nick recommended: the viewed object owns shape and >> strides just as it owns the data. The viewing object increases the >> reference count of the viewed object and thus assures that data, shape >> and strides don't go away prematurely. > > That doesn't work if e.g. you take a slice of a memoryview object, since the > shape changes in the process. > See http://bugs.python.org/issue4580
I have zero problem whatsoever if slice assignment TO a memoryview object is permitted only if the shape stays the same (i.e. I think that issue should be closed as "not a bug"). The buffer protocol permits you to edit the DATA held by another object. It doesn't let you edit the *structure* of that object (which is what would be implied by changing the shape of the object). Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- _______________________________________________ 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