Anne Archibald-3 wrote > ... You'd also have to make sure that all code that tries to write to an > array really checks the writable flag.
If there is code out there which modifies arrays without checking the write flag then it's already on buggy-territory. In terms of value vs functions, surely adding an extra pair of empty parens is not going to be a big deal, although yes it would be a breaking change? The advantage of piggybacking on the write-check is that it doesn't really matter how liberal the original author was with the write checks - you can increment the counter as many times as you like, though removing unnecessary increments would be vaguely helpful if this does end up being implemented as I suggest - I suppose you could also offer an optional keep_it_clean flag in the is_writeable call if you really wanted. > Rather than making this happen for all arrays, does it make sense to use > an > array subclass with a "dirty flag", maybe even if this requires manual > setting in some cases? I have no idea what the reality is of trying to subclass ndarray, neither at the C level nor at the python level, but perhaps this wouldn't be too bad. I just thought that you could do such a neat job down at the C level it would be nice to make it happen. Also, regarding "dirty flags", it's harder to imagine that working with the examples I gave since their may be more than one "consumers" of the hash and thus an array could be dirty from the point of view of one consumer, but clean from the point of view of another. Sebastian wrote > Another issue is, which may be a non-issue, that this design is > inherently not quite thread safe. In terms of thread safety, I guess it's a bit complicated...I'd hoped that it would be covered by the same logic as the simple write check - although now I think about it again it isn't that simple. It's not really something I know anything about in the context of numpy, so I guess I shouldn't try and make any further wild assertions! -- View this message in context: http://numpy-discussion.10968.n7.nabble.com/feature-request-increment-counter-on-write-check-tp41015p41020.html Sent from the Numpy-discussion mailing list archive at Nabble.com. _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion