Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Dictionary Comprehension
#1
If you want to learn more about Python dictionary comprehension, This tutorial is for you.
Reply
#2
Quote:Dictionary is an unordered, changeable and indexed collection of items.

This is True for Python <= 3.5.

Since Python 3.6 it's an implementation detail, that the insertion order is preserved.
Since Python 3.7 it's a language feature.

To make a list unique and keep the insertion order:
my_list = [1,1,1,3,-5,4,1]
unique_keys = list(dict.fromkeys(my_list))
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#3
Is it just me or there is really influx of links to substandard tutorials?
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#4
(Sep-21-2020, 11:25 AM)perfringo Wrote: Is it just me or there is really influx of links to substandard tutorials?
It's not just you.
Reply


Forum Jump:

User Panel Messages

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