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

like dict(zip( or dict(getmembers(asdf)).keys(), it's idiomatic code. it wouldn't have occurred to me the first time i had to write such a function, but now that i've taken a few moments to read the article i find it clearer than the list comprehension version (because the constant only appears once) and nicer than the numpy version in that it doesn't require an extra dependency.

may save a few keystrokes some rainy day. good post.



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

Search: