关于使用thrift来包装python 的问题,谢谢大家

sssjszz 2011-08-27 01:39:28
我刚开始用thrift来给pytho开发的工程包装接口,有个问题想请教一下各位,谢谢。
python中会有list类型,在里面可以包含不同类型的数据,在thrift的基本数据类型里没有和这个对应的类型,那怎么实现这样的参数的传递?
另外如果函数的参数提供默认值,那么怎么包装?
谢谢大家了~
...全文
234 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
muzhi007 2013-01-26
  • 打赏
  • 举报
回复
thrift也有list类型,参考http://thrift.apache.org/docs/types/ Containers Thrift containers are strongly typed containers that map to commonly used and commonly available container types in most programming languages. There are three container types: list: An ordered list of elements. Translates to an STL vector, Java ArrayList, native arrays in scripting languages, etc. set: An unordered set of unique elements. Translates to an STL set, Java HashSet, set in Python, etc. Note: PHP does not support sets, so it is treated similar to a List map: A map of strictly unique keys to values. Translates to an STL map, Java HashMap, PHP associative array, Python/Ruby dictionary, etc. While defaults are provided, the type mappings are not explicitly fixed. Custom code generator directives have been added to allow substitution of custom types in various destination languages.

20,808

社区成员

发帖
与我相关
我的任务
社区描述
Hadoop生态大数据交流社区,致力于有Hadoop,hive,Spark,Hbase,Flink,ClickHouse,Kafka,数据仓库,大数据集群运维技术分享和交流等。致力于收集优质的博客
社区管理员
  • 分布式计算/Hadoop社区
  • 涤生大数据
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧