python 泛型_Python和泛型编程

讨论了Python是否支持泛型编程,以及它与C++模板的比较。有人认为Python的动态类型使得它在某种程度上实现了泛型,但缺乏类型检查和特化等特性。
摘要由CSDN通过智能技术生成

Hi,

I wonder, does Python support generic programming paradigm, and to what extent

(I guess, it doesn''t do it in full)? And (or) does it move in that direction?

Will we ever see

concept WellAlright:

...

constructs in Python?

Isn''t it right time to reserve "concept" as a keyword ;-)

Sincerely yours, Roman Suzi

--

rn*@onego.ru =\= My AI powered by GNU/Linux RedHat 7.3

解决方案Roman Suzi wrote:

I wonder, does Python support generic programming paradigm, and to what extent

It appears to me to support generics at least as well as C++ does. I

just write normal code (no typechecks) and voila, the equivalent of C++

templates (at least). What do you think is missing?

Alex

On Fri, 22 Oct 2004 00:25:28 +0200, Alex Martelli wrote:

Roman Suzi wrote:

I wonder, does Python support generic programming paradigm, and to what extent

It appears to me to support generics at least as well as C++ does. I

just write normal code (no typechecks) and voila, the equivalent of C++

templates (at least). What do you think is missing?

The handcuffs.

Alex Martelli wrote:Roman Suzi wrote:

I wonder, does Python support generic programming paradigm, and to what extent

It appears to me to support generics at least as well as C++ does. I

just write normal code (no typechecks) and voila, the equivalent of C++

templates (at least). What do you think is missing?

Alex

How about specialization? I''m relatively new to Python. I ask for

information, not to be argumentative.

If you have, for example, several data-types for matrices, how do you

write code that will automatically find the right routine for quickly

multiplying a vector by a diagonal matrix represented as a vector, and

automatically call the right code for multiplying by a sparse matrix

represented by some sparse coding, etc?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值