Steven D'Aprano <[email protected]> added the comment:
I'm sorry, I don't see why you think this will improve code readability. I also
expect it will be harder to teach than the current code.
open("file.img", "wb") just needs the user to learn about reading and writing
files, and the difference between binary and text files. It works the same way
in probably dozens of different languages.
open("file.img", File.Write | File.Binary | File.Disk) needs the beginner to
learn the same details, *plus* they have to learn about this mystery File
object, classes, dot notation, `|` the bitwise-or operator, and how to import
File from the io module.
My guess is that File.Write etc are just enums equivalent to strings 'w' and
'b', but what's File.Disk?
What else does this File object do?
----------
nosy: +steven.daprano
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46766>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com