包含在标准库中的模块? [英] Modules for inclusion in standard library?

查看:63
本文介绍了包含在标准库中的模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


目前python-dev正在讨论将Jason Orendorff的路径模块

纳入标准库。


你有没有其他好的和有价值的Python模块,你会认为是/ b $ b无bug,成熟(包括很长的发布距离)并且非常有用$>
被授予stdlib中的一个位置?


就我而言,ctypes似乎是一个开头的建议。


Reinhold

解决方案

Reinhold Birkenfeld< re ********************** **@wolke7.net>写道:

您好,
目前,python-dev正在讨论将Jason Orendorff的路径模块包含在标准库中。




之前我从未使用过路径模块,虽然我听说过很好的事情。但是,它似乎有unicode路径名的问题,至少在Windows上是



C:\> mkdir sp?m


C:\ sp?m> py24

Python 2.4.1(#65,2005年3月30日,09:13:57)[MSC v.1310 32 bit (英特尔)] on win32

输入help,copyright,credit等等。或许可证或有关更多信息。

来自路径导入路径
path.getcwd()
Traceback(最近一次调用)最后):

文件"< stdin>",第1行,在?

文件C:\ TSS5 \ components \ __Pythonlib \ path.py",第97行,在getcwd中

返回路径(os.getcwd())

UnicodeDecodeError:''ascii''编解码器无法解码字节0xe4位置5:序数不在范围内(128)




虽然看起来这可以通过将此构造函数添加到
路径类:

def __new __(cls,init = u""):

if isinstance(init,unicode):

返回_base .__ new __(cls,init)

返回_base .__ new __(cls,init,sys.getfilesystemencoding())

我真的很感激Python的unicode支持会更好

;-),和m aybe将它添加到路径模块比向
os.path更容易。


Thomas


2005年6月27日,Reinhold Birkenfeld< re ************************ @ wolke7.net>写道:

你是否有任何其他优秀和有价值的Python模块,你会认为它们是无错误的,成熟的(包括很长的发布距离)并且足够有用
在stdlib中获得了一席之地?


首先,数字/ numarray,显然!


我也想看看wxPython,pygame和SciPy,但这些可能太重了...... b $ b重量级。对于广泛使用的软件包而言,良好的分发系统可能比在标准的

库中包含所有内容更好的解决方案。

就我而言,ctypes似乎是一个建议开始。




我认为ctypes只是*必须*早点进入那里。我的经验

在Python中处理二进制数据是因为与C相比,这是一个痛苦的问题,而且更像机器的行为和优雅的代码,它越慢。我已经避免使用ctypes来获得

多种原因,但如果是在

标准库中,我可能会使用它。


- Fredrik Johansson


Reinhold Birkenfeld写道:

就我而言,ctypes似乎是一个建议开始。




我相信这已经在之前的某个地方进行了讨论和结论

是ctypes不应该被列入Python的候选者

stdlib因为人们不想要stdlib中的东西可以制作

Python段错误。


STeVe


Hello,

at the moment python-dev is discussing including Jason Orendorff''s path module
into the standard library.

Do you have any other good and valued Python modules that you would think are
bug-free, mature (that includes a long release distance) and useful enough to
be granted a place in the stdlib?

For my part, ctypes seems like a suggestion to start with.

Reinhold

解决方案

Reinhold Birkenfeld <re************************@wolke7.net> writes:

Hello,

at the moment python-dev is discussing including Jason Orendorff''s path module
into the standard library.



I have never used the path module before, although I''ve heard good
things about it. But, it seems to have problems with unicode pathnames,
at least on windows:

C:\>mkdir sp?m

C:\sp?m>py24
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

from path import path
path.getcwd() Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "C:\TSS5\components\_Pythonlib\path.py", line 97, in getcwd
return path(os.getcwd())
UnicodeDecodeError: ''ascii'' codec can''t decode byte 0xe4 in position 5: ordinal not in range(128)



Although it seems this could be fixed by adding this constructor to the
path class:

def __new__(cls, init=u""):
if isinstance(init, unicode):
return _base.__new__(cls, init)
return _base.__new__(cls, init, sys.getfilesystemencoding())

I would really appreciate if Python''s unicode support would be better
;-), and maybe it''s easier to add this to the path module than to
os.path.

Thomas


On 6/27/05, Reinhold Birkenfeld <re************************@wolke7.net> wrote:

Do you have any other good and valued Python modules that you would thinkare
bug-free, mature (that includes a long release distance) and useful enough to
be granted a place in the stdlib?
First of all, numeric/numarray, obviously!

I''d also like to see wxPython, pygame and SciPy, but these may be too
heavy-weight. A good distribution system for widely used packages may
be a better solution than including everything in the standard
library.
For my part, ctypes seems like a suggestion to start with.



I think ctypes simply *must* go in there sooner later. My experience
dealing with binary data in Python is that it''s a pain in the neck
compared to C, and the more machine-like behaviour and elegant code
you want, the slower it gets. I have refrained from using ctypes for a
number of reasons, but I would probably use it if it was in the
standard library.

-- Fredrik Johansson


Reinhold Birkenfeld wrote:

For my part, ctypes seems like a suggestion to start with.



I believe this has been discussed somewhere before and the conclusion
was that ctypes should not be a candidate for inclusion in the Python
stdlib because people don''t want things in the stdlib that can make
Python segfault.

STeVe


这篇关于包含在标准库中的模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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