-
Notifications
You must be signed in to change notification settings - Fork 1
Design
In order to be easy to type,
use all lowercase if it won't hurt readability (e.g. readuntil
),
otherwise use camelCase.
If a method is pure and takes no extra argument (e.g. len
), it should be a property.
However, type conversion may not be pure.
It depends on the source type (e.g. list
or generator
).
For the consistency, all type conversion method which take no extra argument should be properties.
Python's file has a size hint parameter in some method, like readline
.
Hitting such size limit indicates a mismatched protocol.
For example, if we run readline(2)
for input aabb\n
,
the remaining bb\n
would be unexpected in next read.
We should raise an error instead of truncate,
so we decided to remove such parameter in our wrapper.
For the same reason,
our read
(alias of exactly
or readexactly
) method will return a string/bytes with exactly the given size.
If you know nothing about the size and the delimiter, use some
(alias of readsome
) to get all currently available data.
In order to avoid the resource being exhausted, the underlying buffer will raise an OverflowError
when it grows too large.