Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment:

The same function has two distinct behaviours:
- If you pass a number, it return a bytes object.
- If you pass a buffer, it returns a number!
Different arguments and different return types: they should have
different names IMO.

io.py proposes read(n) and readinto(buf) for this distinction, and I
fail to see a reason why PySSL_SSLread need to be different:

- readinto(buf, count=-1) could be similar to the actual PySSL_SSLread.
the "count" defaults to len(buf).
- read(count) could be implemented in C or python (or not at all), it is
equivalent to:
    def read(self, count=1024):
        buf = bytearray(count)
        nb = self.readinto(buf)
        return bytes(buf[:nb])

----------
nosy: +amaury.forgeotdarc

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3805>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to