I’m trying to understand the keyword arguments write
, truncate
, . . . , of the open()
function. I put a link to the documentation at the end of this message.
Specifically, I want to know

What it means if you specify
write=true
alone. Does it implytruncate
? 
What happens if I specify both
write=true
andtruncate=false
without specifyingappend
or withappend=false
?
It turns out that you need to solve some “equations” to find out the default values of the five boolean keywords.
Does the manual actually pose a mathematical question for the reader to solve?
"Solve the following coupled set of equations:
read == !write,
write == truncate  append,
truncate == !read & write,
where append == false
". Then what is the value of create
as defined by
create == !read & write  truncate  append
?
Actually, I’ve now solve the coupled equations in my head and I think the answer is write == truncate == !read
and the solution isn’t unique: there are two solutions: (write, truncate, read) == (true, true, false)
or (false, false, true)
.
Therefore, when append == false
(default value), write==true
does imply truncate==true
. That’s the answer to question 1 above.
I still don’t know the answer to question 2 above. Would it be overwriting the existing file from the top? (Here I’m remembering Fortran’s position="rewind"
.)