MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/itzn13/an_update_on_python_4/g5khzt9/?context=3
r/Python • u/anyfactor Freelancer. AnyFactor.xyz • Sep 16 '20
389 comments sorted by
View all comments
Show parent comments
12
It's definitely not an anti-pattern, and, in fact, the literals perform faster.
-1 u/[deleted] Sep 16 '20 How do they perform faster? Surely it's the same method? 8 u/SaltyHashes Sep 16 '20 IIRC it's faster because it doesn't even have to call a method. 1 u/[deleted] Sep 17 '20 Yeah I see now, I'm surprised the JIT compiler can't make the same optimisation for the empty dict() case or with just literals inside. → More replies (0)
-1
How do they perform faster? Surely it's the same method?
8 u/SaltyHashes Sep 16 '20 IIRC it's faster because it doesn't even have to call a method. 1 u/[deleted] Sep 17 '20 Yeah I see now, I'm surprised the JIT compiler can't make the same optimisation for the empty dict() case or with just literals inside. → More replies (0)
8
IIRC it's faster because it doesn't even have to call a method.
1 u/[deleted] Sep 17 '20 Yeah I see now, I'm surprised the JIT compiler can't make the same optimisation for the empty dict() case or with just literals inside. → More replies (0)
1
Yeah I see now, I'm surprised the JIT compiler can't make the same optimisation for the empty dict() case or with just literals inside.
→ More replies (0)
12
u/hillgod Sep 16 '20
It's definitely not an anti-pattern, and, in fact, the literals perform faster.