On 17/05/2020 19:43, David Mertz wrote:
I believe boolean mode switches are usually a bad design
for Python.  Not always, there are exceptions like open().

Actually, open() is a really bad example. It does have a flag, "closefd" which if False and a file descriptor was passed in rather than a filename leaves the file descriptor open when the file object is closed. The mode parameter than most people will be thinking about really is a mode parameter, not a flag; it folds together four basic opening modes (read, write, exclusive, append), an update flag and a text/binary flag. The former universal newlines flag got separated out to be a mode parameter all its own when it turned out not to be a simple flag after all. I seem to remember that separation being somewhat painful...

--
Rhodri James *-* Kynesim Ltd
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/ML7BU75U6R36Y2MKDD3B4UYZWRZHAIFT/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to