[Tutor] Clearing the Deque • Picturing Python’s `deque` data structure

ThreeBlindQuarks threesomequarks at proton.me
Wed Nov 8 19:43:16 EST 2023


Alan,

I have always heard the word as "Deck" while also have a word from removing something from a Queue (pronounced something like the Japanese  級 pronounced kyu or the way some alphabets say the letter Q as de-queue or like DQ or dee-kyu. The opposite is a bit like NQ.

As you note, the problem in English is that many verbs become nouns and vice versa and can often become adjectives and adverbs and more. You can queue things in a queue and you can stack things in a stacked stack and of course you can put a deck of cards in a deque.

This reminds me a bit of the string theory debate about various version of open versus closed strings that turn out all to be different ways of looking at a higher theory and are all in some sense equally valid. In python, all kinds of data structures and implementation can be used to create a list-like or vector-like data structure with methods that allow any combination of adding or removing or replacing one or more items in front, in back, or in middle, or concatenating multiple such structures or creating other effects like a union or intersection. These "objects" vary in many ways in internal details and ideas about efficiency and underneath it some may be implemented using simple lists, or dictionaries or vectors that can grow and shrink as needed. They can be composite objects, such as for example a set accompanied by a sort of index. Many such designs should be considered horrible.

I am reminded at my reaction to an implementation in JavaScript of an Array.  A main data structure was re-used in that a dictionary of sorts would be examined and only keys like "53" that looked like a number would be considered and put into numeric order and be viewed as an Array. Elements were allowed to be missing and so on. Implementation could not have been very efficient but it meant you did not need yet another data structure at that time.

So back to Deque, it may be that it is what a LIST could have been had they wanted a nice implementation with lots of features. 

Maybe they could have named it something like schlange or even ouroboros.

Sent with Proton Mail secure email.

On Wednesday, November 8th, 2023 at 6:36 PM, Alan Gauld via Tutor <tutor at python.org> wrote:


> On 08/11/2023 20:27, dn via Tutor wrote:
> 
> > > > *pronounced like “deck"
> > > > New Zealand-style pronounciation?
> 
> > Actually (a very English exclamation), Stephen is based in London!
> > 
> > How would you like it pronounced?
> 
> 
> I've only ever heard it pronounced as Dee-Queue.
> 
> Differentiated from deque in that it is a noun and not a verb.
> So context is sufficient. I've certainly never heard it called
> a deck!
> 
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
> 
> 
> 
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list