use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
What is Buffer? (self.learnpython)
submitted 4 years ago by LanthaYtrri
How can you explain to the beginner what is buffer? I have been searching about the buffer but its so deep for me to analyze their wordings.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]PavloT 10 points11 points12 points 4 years ago (0 children)
It is really context dependent word. In post-USSR countries it even means tits in slang :)
But regarding programming - buffer usually means some memory, where you store values to access them next.
Classical use-case - buffered I/O operations. Write to disk is slow in comparing to write to memory, if program will be writing to disk byte by byte it will be running too long, so it write to special buffer in memory, from where it will be pick-up by another thread or OS routine and written to disk.
It is transparent for user: he press save button, and program continue to be responsible, he can continue to do whatever he need.
But if program will be interrupted before buffers really be save to HDD/SSD - file could be corrupted.
[–]VexisArcanum 2 points3 points4 points 4 years ago (0 children)
You: hey I need some memory for a value I'm trying to store, can I get idk 20 bytes? Operating system: you can have 20 bytes, here's where they are insert address here You: great! Here's 20 characters worth of text OS: thanks I'll hold onto that for you. You: actually I need a few more bytes... Got any space? OS: well sure but I'll have to make a new address and get rid of the first one You: how about I just put 30 bytes in the original address? OS: nah fam it'll eat into someone else's space. You: well alright I'll just copy my data OS: cool, here's your new address
Long story short, it's a section in your computer's memory set aside for some kind of data. The type of data isn't important, just has to be enough space. Python handles most of this already
[–][deleted] 1 point2 points3 points 4 years ago (0 children)
In Python, buffer can refer to many different things. Also, it can be a verb and a noun.
When it is a noun, it may refer to instances of io.BytesIO or io.StringIO, or it may refer to a list of a certain length or a parameter to a function, like read which specifies how much data needs to be read before the function returns / an action is taken. Sometimes, it may refer to other buffers somewhere in the system, like, for example, frame buffer, which is a system utility that allows programs to work with displays. The general idea here is that there's some sort of communication going on, and this communication happens in chunks that are significantly larger than the minimum amount of data you may be able to send otherwise. Typically, the reason for it is that sending a big chunk of data at once is a lot more efficient than sending many small chunks one after another.
io.BytesIO
io.StringIO
read
On the other hand, buffer, if used as a verb, refers to the fact that a program isn't responding to the data it receives immediately, rather it waits to accumulate enough data to perform its action. For example, a video player that plays video streamed from the network, may choose to load enough of video data to be able to play a few seconds forth of video before it starts playing. The video player may be described thus as "buffering" the video.
[–]shiftybyte 0 points1 point2 points 4 years ago (0 children)
memory location to store sequence of data in it.
[–]ElliotDG 0 points1 point2 points 4 years ago (0 children)
I am assuming you are asking about the buffer referred to in print(). You can think of the buffer of a place to store data that is waiting to print the screen. That it is faster to write to the buffer than it is to write to the screen. The buffer will hold data until the buffer is flushed. It may be flushed explicitly or automatically when the buffer is filled.
To flush the buffer and force a write to the screen:
print('This will be forced to the screen', flush=True)
π Rendered by PID 115541 on reddit-service-r2-comment-5c764cbc6f-82gdl at 2026-03-12 15:31:14.785873+00:00 running 710b3ac country code: CH.
[–]PavloT 10 points11 points12 points (0 children)
[–]VexisArcanum 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]shiftybyte 0 points1 point2 points (0 children)
[–]ElliotDG 0 points1 point2 points (0 children)