[Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as

Fred Drake fred at fdrake.net
Wed Feb 27 14:56:35 CET 2013


On Wed, Feb 27, 2013 at 8:30 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> I don't think extra-strong typing of constants is really useful in
> practice; it smells a bit like private methods to me.

I think checking that a value comes from a particular enum *is* a degree of
hand-holding.  For libraries or frameworks whose users aren't expected to
know them exhaustively, making reasonable checks of parameters can
substantially reduce the number of ways it can be used incorrectly.  Outside
performance critical code, this is a win.


  -Fred

-- 
Fred L. Drake, Jr.    <fred at fdrake.net>
"A storm broke loose in my mind."  --Albert Einstein


More information about the Python-Dev mailing list