[Python-Dev] PEP 8 and optional underscores

Benjamin Peterson musiccomposition at gmail.com
Wed Jun 11 20:21:13 CEST 2008


On Wed, Jun 11, 2008 at 1:03 PM, Raymond Hettinger <python at rcn.com> wrote:
> "Function names should be lowercase, with words separated by underscores as
> necessary to improve readability." -- PEP 8
>
> If I'm reading this correctly, then underscores are not required
>  everywhere.  Can some of these be shortened?
>
>   function:: active_count()
>   method:: Thread.get_name()
>   method:: Thread.is_alive()
>   method:: Thread.is_daemon()
>   method:: Thread.set_daemon(daemonic)
>
> In some cases, the mental pronounciation changes and affects my perception
> of meaning.  For example, Thread.setName or Thread.setname both feel like a
> setter to me, but Thread.set_name causes a mental pause and a momentary
> double-take (is it the name of a set?).

Actually, in this case, I think the Pythonic thing to do would be to
use properties.


-- 
Cheers,
Benjamin Peterson
"There's no place like 127.0.0.1."


More information about the Python-Dev mailing list