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

which is nicer?

    float(len(str))
or

    str.len().float()
Also, there's numerous ways of doing the same thing, despite that being contrary to python's philosophy


Actchooally: Python's philosophy (the zen of python) states:

There should be one-- and preferably only one --obvious way to do it.

So, the answer is to pick the obvious choice, which in this case will depend on the style guide of the project you are working on, and whether they prefer the lisp style syntax or the OO property of style.




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

Search: