[Python-Dev] PEP 8 and optional underscores

Guido van Rossum guido at python.org
Thu Jun 12 16:17:42 CEST 2008


If you want to have a meaningful discussion about this, the addition
of the multiprocessing package and the recent threading.py API changes
must be rolled back, so we can design a proper API without the beta 1
pressure. Some observations:

- If it's isAlive() in Java style, it should be is_alive in Python style.

- I like *methods* (and functions) named isfoo or is_foo, but I like
the corresponding properties to be called just foo.

- I think properties instead of simple setters and getters is great
(as long as the setters implied in the property enforce the
conditions).

- I hate typing underscores, since they require using the shift key
*and* moving my hands away from the home position on the keybord.

--Guido

On Thu, Jun 12, 2008 at 6:04 AM, Barry Warsaw <barry at python.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Jun 12, 2008, at 8:29 AM, Facundo Batista wrote:
>
>> 2008/6/12 Barry Warsaw <barry at python.org>:
>>
>>>> function:: active_count()
>>>> method:: Thread.get_name()
>>>> method:: Thread.is_alive()
>>>> method:: Thread.is_daemon()
>>>> method:: Thread.set_daemon(daemonic)
>>>
>>> +1 on opting for properties in the specific cases here where it makes
>>> sense.
>>
>> I'm +1 too... but which is the normal procedure here?
>>
>> Should it be...
>>
>>  2.n : .is_alive()
>>  2.n+1 : .is_alive() (deprecated), .alive (recommended)
>>  2.n+2 : .alive
>
> Personally, I'd go with a property .is_alive
>
> - -Barry
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (Darwin)
>
> iQCVAwUBSFEeznEjvBPtnXfVAQKEeQP8CdF+N1wX4Qwxn7iglGYq0peZEYagn4JG
> dOkP+TOkAzSciNfIotPaHJTGbyXsFtxLe3Rpq8r56/sPhHKS66+vCMojLBK64Iue
> 7/PDhZ300KRpPtbJOOA4OmqI2rz1fO+vflavICZlx7oIwC25L7dQSteu/NBJYGJN
> QX/Z8WutBng=
> =1B3v
> -----END PGP SIGNATURE-----
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/guido%40python.org
>



-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list