thriftrw / thriftrw-python

A Thrift encoding library for Python
MIT License
36 stars 10 forks source link

Expose the Protocol on $module.{dumps,loads} #106

Closed abhinav closed 8 years ago

abhinav commented 8 years ago

This allows you to do:

my_module = thriftrw.load(..)
my_module.dumps.protocol

If you need to access the protocol associated with the module.

Use case: If you are doing low level stuff directly with the message/etc. you want to be sure you're using the same Protocol as the generated module.

abhinav commented 8 years ago

@blampe @breerly @junchaowu

blampe commented 8 years ago

:sheep:

jc-fireball commented 8 years ago

why does readonly give you this function? wasn't it working before?

abhinav commented 8 years ago

@junchaowu See http://docs.cython.org/src/userguide/extension_types.html

If you declare an extension type, attributes for it are available from C only by default. Marking it as readonly or public generates some extra code to make the attribute accessible from Python.

jc-fireball commented 8 years ago

oh good to know.