Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    > [tl;dr] Use {} to create dictionaries, especially if you are pre-populating them, unless the literal syntax does not work for your case.
    [...]
    > ...as a general principle I try to avoid code constructions I know to introduce performance hits.
This is not Pythonic. I appreciate the article and what it showed me, but I do not agree with the conclusion. Do whatever makes your code most readable. Sometimes this may be {}, and sometimes it may be dict(). Most code will not be in a performance-critical path.

"Premature optimization is the root of all evil".



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: