New submission from Chris Lambacher:

The use case for this is that when you are in a template and you want to use 
the Enum instances in a conditional, then you need to pass the Enum class to 
the template or start using someenumvariable.__class__.someenumvalue. Instead 
it would be useful to be able to do someenumvariable.someenumvalue. 
Implimenting as __getattr__ on enum class allows real attributes to take 
precedence and also allows for overriding of behaviour in child classes.

----------
components: Library (Lib)
files: getattr_for_enum_class.patch
keywords: patch
messages: 197611
nosy: lambacck
priority: normal
severity: normal
status: open
title: Enum should have a __getattr__ that makes all the instances available 
from an instance
versions: Python 3.4
Added file: http://bugs.python.org/file31745/getattr_for_enum_class.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19011>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to