Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Disjoint, Subset, and Superset

jwiede on Feb. 29, 2020

Might want to mention how empty set (set()) is a subset of all sets, and a proper subset of all sets (except itself, obviously).

jwiede on Feb. 29, 2020

(sorry, hit button too soon)

This can lead to unexpected results when a set you believe contains elements is actually empty, esp. if your code expects the set in question to NOT be a subset/proper subset of another set.

Assert the set in question is a proper superset of set() in order to catch such cases. If the set in question winds up empty, that assertion will fail.

Johnny Swanny on March 14, 2020

Really good point jwiede, thanks for the info.

Become a Member to join the conversation.