| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Hi Gobot, thank you for your efforts. |
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you for helping out.
As you know I'm not much convinced to the practical benefits of faster Enums.
If you could cover the new Enum class with unit tests, so it is clear what features are supported, I would be confident enough that it wouldn't break anything so that we can merge it nonetheless.
My two concerns are
For tests, we can probably reuse most tests from the cpython:
Sorry, something went wrong.
|
|
||
| def to_dict( | ||
| self, casing: Casing = Casing.CAMEL, include_default_values: bool = False | ||
| self, casing: Optional[Casing] = None, include_default_values: bool = False |
There was a problem hiding this comment.
Since Enums are not mutable, do we need this change? Or was passing a default not possible with the new class?
I think it was helpful for developers to see the default casing from the parameter.
Sorry, something went wrong.
There was a problem hiding this comment.
Unfortunately it raises an AttributeError as the class hasn't been created yet.
Sorry, something went wrong.
There was a problem hiding this comment.
Actually, I guess we don't need to use Betterproto Enums for Casing. Perhaps just keep things simple and use the python Enum instead?
Sorry, something went wrong.
There was a problem hiding this comment.
I don't think it's that big of a deal, if someone wants to see the default they can just view source.
Sorry, something went wrong.
|
Everything should now work |
Sorry, something went wrong.
|
This is a bad idea, making these consistent is too much of a pain, sticking with the current implementation is fine. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Significant speed improvements over the builtin Enum class.
Full tests here https://gist.github.com/Gobot1234/e3883e9db151ce3b33adf4d38c140936
Fixes a bug discussed on slack relating to to_dict and IndexErrors when using Enums.