[Python-3000] Immutable bytes type and bsddb or other IO

Gregory P. Smith greg at electricrain.com
Thu Aug 23 21:24:08 CEST 2007


On Thu, Aug 23, 2007 at 09:18:59PM +0200, "Martin v. L?wis" wrote:
> > I -detest- the idea of making another temporary copy of the data just
> > to allow the GIL to be released during IO.  data copies == bad.
> > Wasn't a past mailing list thread claiming the bytes type was supposed
> > to be great for IO?  How's that possible unless we add a lock to the
> > bytesobject?  (Its not -likely- that bytes objects will be modified
> > while in use for IO in most circumstances but just the possibility
> > that it could be is a problem)
> 
> I agree. There must be a way to lock a bytes object from modification,
> preferably not by locking an attempt to modify it, but by raising an
> exception when a locked bytes object is modified.
> 
> (I do realise that this gives something very close to immutable bytes
> objects).
> 
> Regards,
> Martin

I like that idea.  Its simple and leaves any actual locking up to a
subclass or other wrapper.

-gps


More information about the Python-3000 mailing list