[Python-ideas] `to_file()` method for strings

Sven R. Kunze srkunze at mail.de
Wed Mar 23 19:27:29 EDT 2016


On 23.03.2016 23:30, Alexander Belopolsky wrote:
>
> On Wed, Mar 23, 2016 at 6:20 PM, Sven R. Kunze <srkunze at mail.de 
> <mailto:srkunze at mail.de>> wrote:
>
>
>     bash:  echo "my string" >> my_file
>     python: with open('my_file', 'w') as f: f.write('my string')
>
> ...
>
>
>     I can tell you from my experience with several aged Python
>     developers that they regularly fail to implement atomic file
>     operations. Just saying.
>
>
> What make you think your bash example implements an atomic write?  It 
> actually performs an append and therefore not equivalent to the python 
> code that followed.

What makes you think that I think my bash example implements an atomic 
write? ;-)


My point was the simplicity of the bash command. Make it Python as 
simple AND atomic here (with file handling) and people will drop bash 
immediately.


Best,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160324/f6f59214/attachment.html>


More information about the Python-ideas mailing list