Python和泛型编程 [英] Python and generic programming

查看:826
本文介绍了Python和泛型编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述






我想知道,Python是否支持通用编程范例,以及在多大程度上支持
(我猜,它没有全部完成)?并且(或)是否向这个方向移动?

我们会看到


概念WellAlright:

... <用
构造Python?

现在还不是保留概念的时候吗?作为关键字;-)

此致,您好,Roman Suzi

-
rn * @ onego.ru = \ =我的AI由GNU / Linux RedHat 7.3提供


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< rn * @onego .RU>写道:
Roman Suzi <rn*@onego.ru> wrote:
我想,Python是否支持通用编程范例,以及在何种程度上
I wonder, does Python support generic programming paradigm, and to what extent




在我看来支持泛型至少和C ++一样。我只需编写正常代码(没有类型检查)和瞧,相当于C ++

模板(至少)。您认为缺少什么?

Alex



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


2004年10月22日星期五00:25:28 +0200,Alex Martelli写道:
On Fri, 22 Oct 2004 00:25:28 +0200, Alex Martelli wrote:
Roman Suzi< rn *@onego.ru>写道:
Roman Suzi <rn*@onego.ru> wrote:
我想,Python是否支持泛型编程范例,以及在何种程度上
I wonder, does Python support generic programming paradigm, and to what extent



在我看来,至少支持泛型就像C ++一样。我只是编写普通代码(没有类型检查)和瞧,相当于C ++
模板(至少)。您认为缺少什么?



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写道:


Alex Martelli wrote:

Roman Suzi< rn *@onego.ru>写道:

Roman Suzi <rn*@onego.ru> wrote:
我想,Python是否支持泛型编程范例,以及在何种程度上
I wonder, does Python support generic programming paradigm, and to what extent



在我看来,至少支持泛型就像C ++一样。我只是编写普通代码(没有类型检查)和瞧,相当于C ++
模板(至少)。您认为缺少什么?

Alex



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




专业化怎么样?我是Python的新手。我要求

信息,不要争论。


如果你有几个矩阵的数据类型,你怎么样? >
写代码将自动快速找到正确的例程

将向量乘以表示为向量的对角矩阵,并且

自动调用正确的代码乘以稀疏矩阵

由一些稀疏编码等表示?



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?


这篇关于Python和泛型编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆