2000 numbers?
This is 16K. Do it in memory. Indeed, by declaring your 16K buffers, you can probably do the whole operation in a single I / O request. And on some large 64-bit systems, 2000 numbers larger or smaller is the default buffer size.
The amount of data is microscopic. Do not waste time optimizing such a small amount of data.
with open( "my file.dat", "rb", 16384 ) as the_file:
my_circular_queue = list( read_the_numbers( the_file ) )
if len(my_circular_queue) >= 2000:
my_circular_queue = my_circular_queue[1:]
my_circular_queue.append( a_new_number )
with open( "my file.dat", "wb", 16384 ) as the_file:
write_the_numbers( the_file, my_circular_queue )
. , .