Not a bad summary. But falls short decisively with lines like: returns the given number of bytes (by default -1) from a specified file.
And yes? What does reading -1 bytes mean? And moreover it's more commonly a number of characters not bytes (we are well and truly into the Unicode era, and Python 3 like it or not). So it's bytes when the file is opened in byte mode else it's characters (which can be one or more bytes), and -1 is just the simplest case of a negative number, any negative number asking read() to read the rest of the file. Which is sort of worth saying in a beginners guide (far from obvious).
The introduction to readable() and writable() is good though. very pleased to see it as these are buried a bit deeply in IOBase documentation and overlooked in the formal Python tutorial: docs.python.org/3/tutorial/inputou...
Not a bad summary. But falls short decisively with lines like: returns the given number of bytes (by default -1) from a specified file.
And yes? What does reading -1 bytes mean? And moreover it's more commonly a number of characters not bytes (we are well and truly into the Unicode era, and Python 3 like it or not). So it's bytes when the file is opened in byte mode else it's characters (which can be one or more bytes), and -1 is just the simplest case of a negative number, any negative number asking read() to read the rest of the file. Which is sort of worth saying in a beginners guide (far from obvious).
The introduction to readable() and writable() is good though. very pleased to see it as these are buried a bit deeply in IOBase documentation and overlooked in the formal Python tutorial: docs.python.org/3/tutorial/inputou...
I appreciate a lot your feedback, I will try more writing good summaries.
Thank you very much 😊