<p dir="ltr">On Aug 1, 2016 7:13 PM, "Arek Bulski" <<a href="mailto:arek.bulski@gmail.com">arek.bulski@gmail.com</a>> wrote:<br>
><br>
> I would like to see few methods added to file() objects:<br>
><br>
> <br>
><br>
> - read(size, *, offset=None) so os.pread() be used going around file description position</p>
<p dir="ltr"><a href="https://docs.python.org/3/library/os.html#os.pread">https://docs.python.org/3/library/os.html#os.pread</a><br>
(Unix)</p>
<p dir="ltr">file.pread?</p>
<p dir="ltr">><br>
> - write(data, *, offset=None) analog os.pwrite()</p>
<p dir="ltr"><a href="https://docs.python.org/3/library/os.html#os.pwrite">https://docs.python.org/3/library/os.html#os.pwrite</a><br>
(Unix)</p>
<p dir="ltr">file.pwrite?</p>
<p dir="ltr">><br>
> - flush(sync=False) so os.fsync(f.fileno()) can optionally follow</p>
<p dir="ltr"><a href="https://docs.python.org/3/library/os.html#os.fsync">https://docs.python.org/3/library/os.html#os.fsync</a><br>
(Unix, Windows)</p>
<p dir="ltr">file.fsync?</p>
<p dir="ltr">><br>
> <br>
><br>
> For text files, offset would probably be not supported or count in characters. New methods could be added like readp/writep/fsync instead of modifying current methods, its debatable.</p>
<p dir="ltr">IDK how this works when wrapped with <br>
<a href="https://docs.python.org/2/library/codecs.html#codecs.open">https://docs.python.org/2/library/codecs.html#codecs.open</a> ?</p>
<p dir="ltr">><br>
> <br>
><br>
> Please tell me how to go about pushing this mainstream.</p>
<p dir="ltr">It's often easier to build a package with the new methods:<br>
- e.g. <a href="https://pypi.python.org/pypi/backports/1.0">https://pypi.python.org/pypi/backports/1.0</a><br>
- <a href="https://pypi.python.org/pypi/pathlib/1.0.1">https://pypi.python.org/pypi/pathlib/1.0.1</a></p>
<p dir="ltr"><a href="https://pypi.python.org/pypi/path.py">https://pypi.python.org/pypi/path.py</a></p>
<p dir="ltr">><br>
> <br>
><br>
><br>
> _______________________________________________<br>
> Python-ideas mailing list<br>
> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/python-ideas">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
> Code of Conduct: <a href="http://python.org/psf/codeofconduct/">http://python.org/psf/codeofconduct/</a><br>
</p>