New submission from Marco Sulla <launchpad....@marco.sulla.e4ward.com>:

As title. I just created it:

https://pastebin.com/pNYezw2V

I think it could be useful to have a more descriptive way to declare a file 
open mode. Many languages has an enum for this.

Maybe open(), os.fdopen(), os.popen() and pathlib.Path.open() can just accept 
also an OpenMode enum as mode parameter, without the need to write 
OpenMode.append.value, for example, but just OpenMode.append. As an 
alternative, OpenMode could be a namedtuple.

I don't know in which module should be put. In `builtins`, `os` or `pathlib`?

----------
components: Library (Lib)
messages: 350203
nosy: Marco Sulla
priority: normal
severity: normal
status: open
title: What about an enum for open() modes?
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37918>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to