
DICTIONARY UNIONS:
If we have two dictionaries a and b that we need to merge, we now use the union operators.
We have the merge operator |:
The update operator |= which updates the original dict.
EXAMPLE:
a= { 1: ‘a’, 2: ‘b’,, 3: ‘c’}
b= {4: ‘d’,5: ‘e’,}
a | = b
print (a)
Output: >> {1: ‘a’, 2: ‘b’, 3: ‘c’, 4: ‘d’, 5: ‘e’}
TYPE HINTING:
In our add_int function, we clearly want to add the same number to itself ( for some mysterious undefined reason). But our editor doesn’t know that, and it is perfectly okay to add two strings together using + — so no warning is given.
What we can now do is specify the expected input type as int. Using this, our editor picks up on the problem immediately. We can get pretty specific about the types included too.
EXAMPLES:


STRING METHODS:
Two new string methods for removing prefixes and suffixes have been added.
EXAMPLE:
“Hello world” . removeprefix(“He”)
Output: >> “llo World”
“Hello World” . removesuffix(“ld”)
Output: >> “Hello Wor”
