Antoine Pitrou added the comment: Bytes objects are immutable, so trying to "copy" them doesn't copy anything actually (it's an optimization):
>>> b = b"x" *10 >>> id(b) 139720033059920 >>> b2 = b[:] >>> id(b2) 139720033059920 FileIO.read() only calls the underlying read() once, you can check the implementation: http://hg.python.org/cpython/file/8002f45377d4/Modules/_io/fileio.c#l703 ---------- _______________________________________ Python tracker <[email protected]> <http://bugs.python.org/issue17440> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
