Python Forum
find the class for indexed counting
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
find the class for indexed counting
#1
i still don't have a document that maps features to module or class names. this problem is not exclusive to Python. this is why i end up over-implementing things that already exist. right now the thing i am looking for is indexed counting. i know Python has it but i can't find its name. anyone know it?

i wish there was a document that maps features to names in the scope of Python. it's hard to start writing one.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
What do you mean by "indexed counting"? Are you looking for something like what enumerate does or something else?
Reply
#3
not that. the term is from my days in CS but probably goes by a different name these days. it refers to indexing over an array of counts in which you can increment, decrement, fetch, or store, any count so indexed, or all the counts at once.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#4
I don't understand the above explanation. My search engine found key-indexed counting but I guess it's something different from what you are referring to.
Reply
#5
that found it a few answers down. it is collections.Counter. i've implemented this in C so i wasn't interested in all those links about algorithms. one thing that probably caused me to overlook this a couple days ago was the direct operation. i was expecting some kind of method call instead of the simpler ctr[key]+=1 to increment the keyed value.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020