Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
pphysch
on Jan 22, 2024
|
parent
|
context
|
favorite
| on:
Performance Analysis of Python's Dict() and {}
One place where I prefer dict() is where dicts are used as "nested kwargs", e.g. in Django's ORM for passing default values.
User.objects.get_or_create( username="bob", defaults=dict( email="bob@example.com", )
this makes it easy to move fields between `defaults` and `kwargs`. Granted, you could achieve the same isomorphism with ** operator, but less readably IMO.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: