this post was submitted on 25 Oct 2024
36 points (97.4% liked)

Python

6438 readers
6 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

πŸ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
πŸ’“ Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] FizzyOrange 8 points 1 month ago (7 children)

Zero surprises. It's the same as in any other language.

[–] CodeMonkey 3 points 1 month ago* (last edited 1 month ago) (5 children)

I was a bit surprised that deque is implemented as a linked list and not, for example, a ring buffer. It would mean that index reads would be constant time (though insert and delete at an index would be linear time), the opposite of using a linked list.

[–] [email protected] 1 points 1 month ago (4 children)

But a ring buffer is a FIFO data structure that can be implemented using linked lists. What ring buffer implementation did you have in mind?

[–] CodeMonkey 1 points 1 month ago

I am used to seeing ring buffers implemented using an array. They are FIFO if you write to the maximum offset and read from the minimum offset but they are double ended if you have a method to read from the maximum offset and write to the minimum offset.

load more comments (3 replies)
load more comments (3 replies)
load more comments (4 replies)