Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
nephanth
on Jan 22, 2024
|
parent
|
context
|
favorite
| on:
Performance Analysis of Python's Dict() and {}
My problem with {} is that the syntax for dicts {x1:y1, x2:y2 ...} and sets {x1, x2 ...} Are very close, and {} is slightly ambiguous.
I've run into bugs because i wrote {} for the empty set. Since then i write dict() and set()
xarope
on Jan 23, 2024
[–]
+1. I've run into this too, and ended up using set() to clarify.
dr_kiszonka
on Jan 23, 2024
|
parent
[–]
You could write, e.g., `flags: set = {}` to get both speed and readability.
Consider applying for YC's Fall 2026 batch!
Applications
are open till July 27.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
I've run into bugs because i wrote {} for the empty set. Since then i write dict() and set()