15.11.20 21:19, Ben Rudiak-Gould пише: > I don't think __bytes__ is necessarily a bad idea, but I want to point > out a couple of things you may be unaware of. First, slicing a > memoryview object creates a subview, so you can wrap your mmap object in > a memoryview and then create slices for each partition, cluster run, > etc. without wasting any memory (but not for fragmented files). Second, > your iterator example works in Python as it stands if you substitute > __iter__ for __bytes__ and writelines for write.
I was going to write the same. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/XHZBJRIAUXVDWKK4JBVTFMWKETUQTUGT/ Code of Conduct: http://python.org/psf/codeofconduct/