thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Haggerty <mumb...@gmail.com>
Subject Re: Introspection of thrift enums in Python
Date Sat, 22 Jun 2013 07:32:09 GMT
Hopefully this patch is a good idea:

https://issues.apache.org/jira/browse/THRIFT-2059

(draft implementation of python 3.4 style enums; can be used on earlier
versions using this package on pypi:

https://pypi.python.org/pypi/enum34/)

Surpisingly easy to do once I got round to doing it.


On Tue, Jun 4, 2013 at 12:32 AM, Will Pierce <willp@nuclei.com> wrote:

> Hi James,
>
> Sorry I should have read more carefully.  You're absolutely right.  The
> thrift_spec class attribute uses TType.I32, so there's no reference back to
> the generated enum class.
>
> It's interesting that the client-code I've seen so far with enums
> essentially hard-codes the relationship between a field using enums and the
> enum class.  This is definitely a deficiency for writing good, clean client
> code.
>
> Until enums from PEP435 <http://www.python.org/dev/peps/pep-0435/> (and
> python 3.4+) is available/practical/deployable, then I'm sure your patches
> will be welcome to help get around this!
>
> As a personal preference, it would be really nice if your patch could
> enhance thrift enums in python so that they emulate the behavior of PEP435
> enums.  That would reduce learning curves and simplify future development,
> if/when we eventually add targetting of python3.4+ to the thrift compiler.
>
> -Will
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message