Le Thursday 21 August 2008 15:30:22 Benjamin Peterson, vous avez écrit : > Issue 3187 is a case where os.listdir tries to decode filenames with > the default file system encoding, but failing that, simply returns the > unencoded bytestring. This was obviously ok in 2.x, but not so good in > py3k where bytes are cleanly separated from unicode.
I'm trying to write a workaround in Python, but I'm unable to write my own class which is compatible with "buffer interface"... What is this interface? It works with bytes, but I don't want to inherit bytes (nor str). class MyBuffer(bytes): def __new__(self, data): obj = bytes.__new__(self, data) obj.myattribute = 42 return obj -- Victor Stinner aka haypo http://www.haypocalc.com/blog/ _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com