Hacker News new | past | comments | ask | show | jobs | submit login

They could add a __bool__ method to the class the returns false when that level of the namespace is empty. That would allow:

   if a.b.c:
       print("c:", a.b.c)



The __contains__ method should be used (and indeed is). What if a.b.c = False?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: