book although set operations can be coded manually in python with other typeslike lists and dictionaries (and often were in the past)python' built-in sets use efficient algorithms and implementation techniques to provide quick and standard operation set literals in python and if you think sets are "cool,they eventually became noticeably coolerwith new syntax for set literals and comprehensions initially added in the python line onlybut backported to python by popular demand in these pythons we can still use the set builtin to make set objectsbut also new set literal formusing the curly braces formerly reserved for dictionaries in and the following are equivalentset([ ]{ built-in call (allnewer set literals ( xthis syntax makes sensegiven that sets are essentially like valueless dictionaries-because set' items are unordereduniqueand immutablethe items behave much like dictionary' keys this operational similarity is even more striking given that dictionary key lists in are view objectswhich support set-like behavior such as intersections and unions (see for more on dictionary view objectsregardless of how set is made displays it using the new literal format python accepts the new literal syntaxbut still displays sets using the display form of the prior section in all pythonsthe set built-in is still required to create empty sets and to build sets from existing iterable objects (short of using set comprehensionsdiscussed later in this but the new literal is convenient for initializing sets of known structure here' what sets look like in xit' the same in except that set results display with ' set(]notationand item order may vary per version (which by definition is irrelevant in sets anyhow) :\codec:\python \python set([ ]{ set('spam'{' '' '' '' 'built-insame as in add all items in an iterable { { {' '' '' '' ' {' '' '' '' 'set literalsnew in (and add('alot' {' '' '' ''alot'' 'methods work as before all the set processing operations discussed in the prior section work the same in xbut the result sets print differently numeric types