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

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: