On 09/04/17 13:58, Mats Wichmann wrote:

> All of these can of course be done without enums.  So the extra benefit
> of an enum is that the set is closed (immutable) and requires
> uniqueness: picking some other value will be an error, 

Indeed, good catch. The value of an enum over an integer is
that the values are limited to those prescribed by the enum,
any attempt to pass or create a different value will be an error.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to