Py 2.6的变化 [英] Py 2.6 changes

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

问题描述

我刚刚重新阅读了Python 2.6中的更改列表,它很大,

有大量的更改和改进,我真的很感动:
http://docs.python.org/dev/whatsnew/2.6。 HTML


我需要很多天才能学到所有这些变化!我可以看到它修复了

我在过去的
中在Python中发现的一些遗漏/问题,比如缺少有关浮点的信息

使用等等。

我看到许多(智能)更新来自Hettinger。


你可以看到语言变得更好你可以从你自己的技巧包中删除经常使用的商品函数/类:' - )(比如

permutations()函数等)。


> Python现在必须用C89编译器编译(19年后!)。这意味着Python源代码树已经删除了自己的memmove和strerror实现,它们位于C89标准库中。



我认为在我等待的时候不要屏住呼吸对我来说更好。

CPython写在C99 :-)

现在数学有阶乘:
http://docs.python.org/dev/library/m...math.factorial

看看如何从Python 3中删除reduce()(I知道它在itertools中,

并且看到我写了一个productory()函数是我多年前用于reduce的第一个

用法,我认为数学模块可以

也获得了productory()函数。

对于Python 2.7 / 3.1我现在想写一篇关于

强调数字文字,如:0b_0101_1111,268_435_456

等。我在D语言中一直使用这些下划线,而且我认为他们是b $ b对于Python来说,这可能是一个微小但重要的改进(并且

下划线比仅仅更好步伐,因为下划线

帮助读取代码的人理解单个

数字。)


再见,

bearophile

解决方案

是************ @ lycos.com 写道:


我认为它对我来说,在我等待时不要屏住呼吸更好。
CPython用C99编写:-)



首先你有说服微软发布C99编译器......祝你好运!


Christian


是************ @ lycos.com 写道:


现在数学有阶乘:
http://docs.python.org/dev/library/m...math.factorial



'真是让人未公开。

是否真的试图精确计算

的任意整数?是否有任何

的方式来请求一个很好的快速近似值

的大整数(例如,使用Gosper的'

修改斯特林'' s公式)?

Alan Isaac


2008年9月1日星期一12:15:53 -0700,bearophileHUGS写道:


现在数学有阶乘:
http://docs.python.org/dev/library/m...math.factorial 看看

reduce()是如何从Python 3(我知道它在itertools中),并且看到

对我来说编写productory()函数是我第一次使用

用于减少,几年前,我认为数学模块也可以获得一个

productory()函数。



productory() - 我不知道这个功能,谷歌搜索通常会出现零售产品搜索
。你的意思是product(),sum()

的模拟,除了它乘以而不是加?或许你的意思是某种类型的因素()
of factorial()。


-

史蒂文


I have just re-read the list of changes in Python 2.6, it''s huge,
there are tons of changes and improvements, I''m really impressed:
http://docs.python.org/dev/whatsnew/2.6.html

I''ll need many days to learn all those changes! I can see it fixes
several of the missing things/problems I have found in Python in the
past, like the lack of information regarding the floating point it
uses, etc.
I have seen that many (smart) updates are from Hettinger.

You can see a language gets better when you can remove often-used
commodity functions/classes from your own ''bag of tricks'' :-) (Like
the permutations() function, etc).

>Python now must be compiled with C89 compilers (after 19 years!). This means that the Python source tree has dropped its own implementations of memmove and strerror, which are in the C89 standard library.<

I presume it''s better for me to not hold my breath while I wait
CPython to be written in C99 :-)
Now math has factorial:
http://docs.python.org/dev/library/m...math.factorial
Seen how reduce() is removed from Python 3 (I know it''s in itertools),
and seeing that for me to write a productory() function was the first
usage I have had for reduce, years ago, I think the math module can
gain a productory() function too.
For Python 2.7/3.1 I''d now like to write a PEP regarding the
underscores into the number literals, like: 0b_0101_1111, 268_435_456
etc. I use such underscores all the time in the D language, and I
think they can be a tiny but significant improvement for Python (and
underscore is much better than just a space, because the underscore
helps the person that reads the code to understand that''s a single
number).

Bye,
bearophile

解决方案

be************@lycos.com wrote:

I presume it''s better for me to not hold my breath while I wait
CPython to be written in C99 :-)

First you have to convince Microsoft to release C99 compiler ... good luck!

Christian


be************@lycos.com wrote:

Now math has factorial:
http://docs.python.org/dev/library/m...math.factorial

That''s rather underdocumented.
Does it really attempt exact calculation
for arbitrary integers?? Is there any
way to request a nice fast approximation
for large integers (e.g., with Gosper''s
modification of Stirling''s formula)?
Alan Isaac


On Mon, 01 Sep 2008 12:15:53 -0700, bearophileHUGS wrote:

Now math has factorial:
http://docs.python.org/dev/library/m...math.factorial Seen how
reduce() is removed from Python 3 (I know it''s in itertools), and seeing
that for me to write a productory() function was the first usage I have
had for reduce, years ago, I think the math module can gain a
productory() function too.

productory() -- I don''t know that function, and googling mostly comes up
with retail product searches. Do you mean product(), the analog of sum()
except that it multiplies instead of adds? Or perhaps you mean some sort
of generalization of factorial().

--
Steven


这篇关于Py 2.6的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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