The question is about API design. The scenario is, I have some bytes of KNOWN length in memory and I want to design a Pythonic API that flushes them to AWS S3
with few RPCs
. By Pythonic, I mean if there is already an accepted API doing this, I want to copy it.
One way is to do something like io.create(filename, content)
. This can be translated into a single HTTP
request using S3
XML
API.
The traditional open
, write
, and close
pattern is a streaming API. open
doesn't accept a length argument so the created stream doesn't know it should buffer all writes into a single RPC.
Of course the API can look like:
with open(filename, buffering="UNLIMITED") as f:
f.write(content)
But buffering doesn't really support "UNLIMITED"
constant.
So what can I do? File a PEP? Thanks.