Message11160
I am actually much for improving Java integration, but IMO Strings and Enums are quite not the same (and don't even share an is-relation in any direction). Looking at https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html an Enum can also be a Planet etc, have custom properties, even methods.
Note that enumMethod in your test also wouldn't accept a String when called in Java-code.
You suggest to let Jython convert silently a String in the role of an element name into a value of Enum subtype. For me this looks like mixing up something like a lookup (e.g. in a map) with an is-relation. Or stated differently: Too much magic, even for Jython users.
That said, I would like to have a proper way to allow the method call you mention (maybe there already is?)
E.g. something like an explicit (is better than implicit...^^) way to let Jython perform Enum-lookup from Python-code.
Maybe we could have an integration with the official Python module for enums https://pypi.python.org/pypi/enum34 (for Python 3, but also backported to several Python 2 versions).
I will think about it and would also wish to hear more opinions. |
|
Date |
User |
Action |
Args |
2017-03-03 11:13:10 | stefan.richthofer | set | messageid: <1488539590.21.0.700888048475.issue2558@psf.upfronthosting.co.za> |
2017-03-03 11:13:10 | stefan.richthofer | set | recipients:
+ stefan.richthofer, jamesmudd |
2017-03-03 11:13:10 | stefan.richthofer | link | issue2558 messages |
2017-03-03 11:13:08 | stefan.richthofer | create | |
|