{' '' '' '' 'union keys and set items views are set-like too if they are hashable--that isif they contain only immutable objectsd {' ' list( items()[(' ' ) items( keys({(' ' )' ' items( {(' ' )' 'items set-like if hashable union view and view dict treated same as its keys items({(' ' )(' ' ){(' ' )(' ' )(' ' )set of key/value pairs dict( items({(' ' )(' ' )}{' ' ' ' ' ' dict accepts iterable sets too see ' coverage of sets if you need refresher on these operations herelet' wrap up with three other quick coding notes for dictionaries sorting dictionary keys in first of allbecause keys does not return list in xthe traditional coding pattern for scanning dictionary by sorted keys in won' work in xd {' ' ' ' ' ' {' ' ' ' ' ' ks keys(sorting view object doesn' workks sort(attributeerror'dict_keysobject has no attribute 'sortto work around thisin you must either convert to list manually or use the sorted call (introduced in and covered in this on either keys view or the dictionary itselfks list(ksks sort(for in ksprint(kd[ ] {' ' ' ' ' ' ks keys(for in sorted(ks)print(kd[ ] force it to be list and then sort xomit outer parens in prints or you can use sorted(on the keys sorted(accepts any iterable sorted(returns its result dictionaries in action