The Python Oracle

using pyserial flush method

Become part or hire the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Chapters
00:00 Question
00:35 Accepted answer
01:15 Thank you

--

Tags
#python #pyserial

#avk47



ACCEPTED ANSWER

Score 3


Information you're sending/writing may be temporarily stored in a buffer, so that a larger chunk can be written in one go. So, if you do:

f = open("test.txt","w")
f.write("Hello")

test.txt will still be empty, until you do f.flush() to flush the buffer. f.close() also flushes the buffer before closing the file.

The document you've got says that it's a "no-op" - a no-operation, meaning that if you're actually using that class, it doesn't do anything. If you're using a subclass, it might do something.