Message413317
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? |
|
Date |
User |
Action |
Args |
2022-02-16 06:42:24 | steven.daprano | set | recipients:
+ steven.daprano, isaacsjohnson22 |
2022-02-16 06:42:24 | steven.daprano | set | messageid: <1644993744.72.0.119748788358.issue46766@roundup.psfhosted.org> |
2022-02-16 06:42:24 | steven.daprano | link | issue46766 messages |
2022-02-16 06:42:24 | steven.daprano | create | |
|