[Python-3000] Immutable bytes -- looking for volunteer
Jeffrey Yasskin
jyasskin at gmail.com
Thu Sep 20 08:07:19 CEST 2007
I've attached a very preliminary patch for this. It makes bytes
immutable but doesn't do either of the other suggested changes. It's
enough to make the tests run, but doesn't do anything to make them
pass. The test results so far are:
270 tests OK.
28 tests failed:
test_asynchat test_asyncore test_audioop test_base64 test_binascii
test_bytes test_codecs test_ftplib test_httplib test_io
test_logging test_mailbox test_marshal test_mhlib test_mmap
test_old_mailbox test_poplib test_smtplib test_socket test_string
test_tarfile test_telnetlib test_unicode test_univnewlines
test_urllib2_localnet test_uuid test_xmlrpc test_zipimport
24 tests skipped:
test_bsddb3 test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp
test_codecmaps_kr test_codecmaps_tw test_curses test_gdbm
test_largefile test_locale test_normalization test_ossaudiodev
test_pep277 test_socket_ssl test_socketserver test_ssl
test_startfile test_timeout test_urllib2net test_urllibnet
test_winreg test_winsound test_xmlrpc_net test_zipfile64
1 skip unexpected on darwin:
test_ssl
On 9/18/07, Guido van Rossum <guido at python.org> wrote:
> On 9/18/07, Jeffrey Yasskin <jyasskin at gmail.com> wrote:
> > I'll take it. I assume it's just a matter of removing the mutating
> > methods and making the tests pass?
>
> And adding __hash__. And (but this could be a separate, later change)
> switch indexing to return 1-char bytes arrays instead of small ints.
> And similar changes to the constructor.
>
> Of course, the devil is in the "making the tests pass".
>
> > I saw but didn't read a couple
> > threads about the buffer API... how much has to change there?
>
> The bytes buffer API should refuse requests for writable buffers.
>
> Since you're so close, please do interrupt me over IM to review
> incomplete work or ideas!
>
> --Guido
>
> > On 9/18/07, Guido van Rossum <guido at python.org> wrote:
> > > No takers? What about those repeated +42 voters? Does anyone want
> > > immutable bytes enough to do a teensy bit of work?
> > >
> > > --Guido
> > >
> > > On 9/17/07, Guido van Rossum <guido at python.org> wrote:
> > > > This may have passed in a thread where no-one was listening, so I'm
> > > > repeating it here.
> > > >
> > > > I'm considering the following option: bytes would always be immutable,
> > > > and for the few places (mostly in io.py) where a mutable bytes buffer
> > > > would be handy, we use the array module. Then it would also make sense
> > > > to make b[0] return a bytes array of length 1 instead of a small int
> > > > -- bytes would be more similar to str in 2.x, albeit completely
> > > > incompatible with str in terms of mixed operations.
> > > >
> > > > It would help if someone explored creating a patch to implement this,
> > > > just to see the minimum amount of code that would need to change
> > > > compared to 3.0a1. (The challenge includes making all the tests pass
> > > > again.)
> > > >
> > > > --
> > > > --Guido van Rossum (home page: http://www.python.org/~guido/)
> > > >
> > >
> > >
> > > --
> > > --Guido van Rossum (home page: http://www.python.org/~guido/)
> > > _______________________________________________
> > > Python-3000 mailing list
> > > Python-3000 at python.org
> > > http://mail.python.org/mailman/listinfo/python-3000
> > > Unsubscribe: http://mail.python.org/mailman/options/python-3000/jyasskin%40gmail.com
> > >
> >
> >
> > --
> > Namasté,
> > Jeffrey Yasskin
> > http://jeffrey.yasskin.info/
> >
> > "Religion is an improper response to the Divine." — "Skinny Legs and
> > All", by Tom Robbins
> >
>
>
> --
> --Guido van Rossum (home page: http://www.python.org/~guido/)
>
--
Namasté,
Jeffrey Yasskin
http://jeffrey.yasskin.info/
"Religion is an improper response to the Divine." — "Skinny Legs and
All", by Tom Robbins
-------------- next part --------------
A non-text attachment was scrubbed...
Name: preliminary_immutable_bytes.patch
Type: application/octet-stream
Size: 22657 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-3000/attachments/20070919/c7b91d7e/attachment-0001.obj
More information about the Python-3000
mailing list