zero-copy array slicing (and PEP 296)

Trevor trevorperrin at hotmail.com
Wed Nov 20 02:14:11 EST 2002


Alex Martelli <aleax at aleax.it> wrote in message news:<bvyC9.29870> 
> Wouldn't it be simpler if your functions also accepted optional parameters 
> for offset and size in bytes?  So the user could call
> 
> hash(bytes, 128)
> encrypt(bytes)
> encrypt(bytes, start, finish-start)
> 
> ...?

Yeah, I could do that.  But if the language handled this it would
simplify the function interface and my code (I wouldn't need to check
for indexing errors, for example), and I could give users the more
familiar slice syntax.

I noticed that PEP 296, for a 'bytes' type, would do just what I want.
 I wonder how that's coming, and if it might be part of Python 2.3...

Trevor



More information about the Python-list mailing list