frozen sets pay no heed to order

Danny CrastoDanny Crasto
1 min read

I superficially assumed a frozenset accounts for the order of items it was constructed with such that the following assertion would fail.

assert(
   frozenset([('a',1), ('b',1)]) == frozenset([('b',1), ('a',1)])
)

Thinking about it for a second, sets are unordered, hence the above assertion holds.

0
Subscribe to my newsletter

Read articles from Danny Crasto directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Danny Crasto
Danny Crasto

I am developer/code-reviewer/debugger/bug-fixer/architect/teacher/builder from dubai, uae