mirror of
https://github.com/satwikkansal/wtfpython.git
synced 2024-09-11 20:17:08 +03:00
Fix typo in dictionary section
This commit is contained in:
parent
a39792bd4b
commit
73a1248d04
2
README.md
vendored
2
README.md
vendored
@ -515,7 +515,7 @@ What is going on here?
|
|||||||
|
|
||||||
> Equality tests between OrderedDict objects are order-sensitive and are implemented as `list(od1.items())==list(od2.items())`. Equality tests between `OrderedDict` objects and other Mapping objects are order-insensitive like regular dictionaries.
|
> Equality tests between OrderedDict objects are order-sensitive and are implemented as `list(od1.items())==list(od2.items())`. Equality tests between `OrderedDict` objects and other Mapping objects are order-insensitive like regular dictionaries.
|
||||||
- The reason for this equality is behavior is that it allows `OrderedDict` objects to be directly substituted anywhere a regular dictionary is used.
|
- The reason for this equality is behavior is that it allows `OrderedDict` objects to be directly substituted anywhere a regular dictionary is used.
|
||||||
- Okay, so why did changing the order affect the lenght of the generated `set` object? The answer is the lack of intransitive equality only. Since sets are "unordered" collections of unique elements, the order in which elements are inserted shouldn't matter. But in this case, it does matter. Let's break it down a bit,
|
- Okay, so why did changing the order affect the length of the generated `set` object? The answer is the lack of intransitive equality only. Since sets are "unordered" collections of unique elements, the order in which elements are inserted shouldn't matter. But in this case, it does matter. Let's break it down a bit,
|
||||||
```py
|
```py
|
||||||
>>> some_set = set()
|
>>> some_set = set()
|
||||||
>>> some_set.add(dictionary) # these are the mapping objects from the snippets above
|
>>> some_set.add(dictionary) # these are the mapping objects from the snippets above
|
||||||
|
Loading…
Reference in New Issue
Block a user