PEP 8002 proposes a new display syntax for the empty set in Python, potentially using a slash inside curly braces (e.g., {/}) to mirror the mathematical empty set symbol. Currently, Python has no literal syntax for an empty set — using {} creates a dictionary instead. The PEP reviews several rejected alternatives including swapping curly braces for sets and using colons for dictionaries. Key concerns include backwards compatibility, as code relying on repr() or str() of an empty set would break. The author finds the change largely trivial and not worth the disruption, though acknowledges it could have made more sense if introduced earlier in Python's history.

7m watch time
2 Comments

Sort: