just saw someone link to https://www.w3schools.com/python/python_dictionaries.asp and insist someone else read it and i glanced over it for ten seconds and wanted to barf a little
there is so much weirdly, subtly wrong here. it's the kind of weird subtly wrong you get if you're mostly interested in doing SEO so you can show a lot of banner ads, and not so interested in teaching beginners anything
like look at this. what is going on here? this is your first introduction to dicts for someone who has never heard of the concept before. this is everything that appears above the fold on my 1440px monitor. and it contains:
- the same dummy dict, twice
- which is heterogeneous and not really a good use case for a dict
- and which doesn't have a meaningful name anyway
- waffling about whether dictionaries are "ordered", a detail that absolutely does not fucking matter 99% of the time you are using a dict
- the terms "key" and "value" twice with no explanation of what the fuck that means
- the phrase "do not allow duplicates", which i will return to later
- printing a dict, which is nice to be able to do i guess but not actually, like, what they are for
here is what is conspicuously absent
- what a dict is
- what a key is
- what dicts are for
- looking up a key
- assigning to a key (this doesn't appear anywhere on the page at all it's like three pages ahead)
it's just this mealy gray slop. it's sentences that are, mostly, sort of, more or less, correct facts, devoid of any real information or context. i'm getting madder the longer i look at it. why would anyone recommend this trash to anyone, let alone a beginner
and it gets better because here is how the page ends
Python Collections (Arrays)
There are four collection data types in the Python programming language:
- List is a collection which is ordered and changeable. Allows duplicate members.
- Tuple is a collection which is ordered and unchangeable. Allows duplicate members.
- Set is a collection which is unordered, unchangeable*, and unindexed. No duplicate members.
- Dictionary is a collection which is ordered** and changeable. No duplicate members.
* Set items are unchangeable, but you can remove and/or add items whenever you like.
** As of Python version 3.7, dictionaries are ordered. In Python 3.6 and earlier, dictionaries are unordered.
When choosing a collection type, it is useful to understand the properties of that type. Choosing the right type for a particular data set could mean retention of meaning, and, it could mean an increase in efficiency or security.
and just. chef kiss. what a glorious mishmash of not giving a fuck. check out how many ways this is wrong or misleading
-
what does "Python Collections (Arrays)" mean?? why is "Arrays" there?? these aren't arrays. dicts are nothing like arrays
-
there are way more than four collections in python. there's a whole fucking
collectionsmodule. there are more than four built in collection types — they forgotfrozenset -
i do not know how you could justify saying sets are unchangeable, but then say haha well actually sets are changeable but the items aren't, which also isn't actually true
-
it says lists allow duplicate members, suggesting that "members" here refers to values. but then it also says dicts don't allow duplicate members, suggesting that "members" refers to keys?
-
How is it more secure to use a list over a dict or whatever
-
they are really obsessed with describing whether dicts are ordered or not when that is not what dicts are about
the page also stresses that dict values can be any type but only ever uses strings as keys; demonstrates calling type() on a dict for reasons i cannot even begin to fathom; invents slightly variant terminology like "key name"; etc.
i am looking at the following pages and becoming even more irate. it repeats a common misconception about del! why is it mentioning .popitem() at all, who even uses that!
i can only assume what happened here is that it's so milquetoast that it looks helpful to beginners despite having no rhyme or reason or order or context or really anything at all. it has microscopic examples not attached to anything else, so you can look at them and feel like they make sense. but i cannot imagine actually learning anything this way. there is no structure, no building towards anything larger. "user input" is the second to last fucking section
this is the ninth grade book report of websites. not only should you not read it, you should be skeptical of advice from anyone who suggests you read it, because they don't know enough to tell how fucking awful it is. it is the purest form of Content™.
just read the god damn python tutorial. it's probably dense in places. that's fine, welcome to programming, skip ahead if you like. fuck around. experiment. ask programmer friends about stuff. reading the equivalent of the standard library manual piped through chatgpt is going to turn your brain to mush
