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

There are a bunch of options for getting user["email"] and user.email to do the same thing:

1. Write a class with custom __getitem__ and __getattr__ methods

2. Use a template system like Django or Jinja that implements this in certain situations

3. Use a library like https://pypi.org/project/python-box/



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

Search: