hsy75的个人空间 https://blog.eetop.cn/vivilife [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

Python that you should know

已有 1247 次阅读| 2012-7-2 15:40 |个人分类:practic_linux

What is Python anyway?
----------------------

Python is an interpreted, interactive object-oriented programming
language suitable (amongst other uses) for distributed application
development, scripting, numeric computing and system testing.  Python
is often compared to Tcl, Perl, Java, JavaScript, Visual Basic or
Scheme.  To find out more about what Python can do for you, point your
browser to http://www.python.org/.


How do I learn Python?
----------------------

The official tutorial is still a good place to start; see
http://docs.python.org/ for online and downloadable versions, as well
as a list of other introductions, and reference documentation.

There's a quickly growing set of books on Python.  See
http://wiki.python.org/moin/PythonBooks for a list.
请参考ref 1

build and install
just download from the python website then check the readme as following :

Build instructions
==================

Before you can build Python, you must first configure it.
Fortunately, the configuration and build process has been automated
for Unix and Linux installations, so all you usually have to do is
type a few commands and sit back.  There are some platforms where
things are not quite as smooth; see the platform. specific notes below.
If you want to build for multiple platforms sharing the same source
tree, see the section on VPATH below.

Start by running the script. "./configure", which determines your
system configuration and creates the Makefile.  (It takes a minute or
two -- please be patient!)  You may want to pass options to the
configure script. -- see the section below on configuration options and
variables.  When it's done, you are ready to run make.

To build Python, you normally type "make" in the toplevel directory.
If you have changed the configuration, the Makefile may have to be
rebuilt.  In this case, you may have to run make again to correctly
build your desired target.  The interpreter executable is built in the
top level directory.

Once you have built a Python interpreter, see the subsections below on
testing and installation.  If you run into trouble, see the next
section.

Previous versions of Python used a manual configuration process that
involved editing the file Modules/Setup.  While this file still exists
and manual configuration is still supported, it is rarely needed any
more: almost all modules are automatically built as appropriate under
guidance of the setup.py script, which is run by Make after the
interpreter has been built.

【hsy75案】practice install:
1 ./configure
franklin@franklin-LifeBook-S-Series:/tmp$ cd Python-2.7.3/
franklin@franklin-LifeBook-S-Series:/tmp/Python-2.7.3$ ls
configure     Demo  Grammar  install-sh  LICENSE  Makefile.pre.in  Modules  Parser  PCbuild        Python  RISCOS    Tools
configure.in  Doc   Include  Lib         Mac      Misc             Objects  PC      pyconfig.h.in  README  setup.py
franklin@franklin-LifeBook-S-Series:/tmp/Python-2.7.3$ ./configure
checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... linux2
checking EXTRAPLATDIR...
checking machine type as reported by uname -m... i686
checking for --without-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for --with-cxx-main=<compiler>... no
checking for g++... g++
configure: WARNING:
........

2 make
3 make test



【hsy75案】Python的設計哲學是“優雅”、“明確”、“簡單”。因此,Perl語言中“總是有多種方法來做同一件事”的理念在Python開發者中通常是難以忍受的。
Python開發者的哲學是“用一種方法,最好是只有一種方法來做一件事”。
而 perl : There's More Than One Way To Do It.(不只一种方法來做这件事。)
[hsy75]所以说一般来讲,是一个矛盾的选择


为什么不使用Perl?

也许你以前并不知道,Perl是另外一种极其流行的开源解释性编程语言。

如果你曾经尝试过用Perl语言编写一个大程序,你一定会自己回答这个问题。在规模较小的时候,Perl程序是简单的。它可以胜任于小型的应用程序 和脚本,“使工作完成”。然而,当你想开始写一些大一点的程序的时候,Perl程序就变得不实用了。我是通过为Yahoo编写大型Perl程序的经验得出 这样的总结的!

与Perl相比,Python程序一定会更简单、更清晰、更易于编写,从而也更加易懂、易维护。我确实也很喜欢Perl,用它来做一些日常的各种事 情。不过当我要写一个程序的时候,我总是想到使用Python,这对我来说已经成了十分自然的事。Perl已经经历了多次大的修正和改变,遗憾的是,即将 发布的Perl 6似乎仍然没有在这个方面做什么改进。

我感到Perl唯一也是十分重要的优势是它庞大的CPAN库——综合Perl存档网络。就如同这个名字所指的意思一样,这是一个巨大的Perl模块集,它大得让人难以置信——你几乎用这些模块在计算机上做任何事情。Perl的模块比Python多的原因之一是Perl拥有更加悠久的历史。或许我会在comp.lang.python上建议把Perl模块移植到Python上的计划。

另外,新的Parrot虚拟机按设计可以运行完全重新设计的Perl 6也可以运行Python和其他解释性语言如Ruby、PHP和Tcl等等。这意味着你将来 或许 可以在Python上使用所有Perl的模块。这将成为两全其美的事——强大的CPAN库与强大的Python语言结合在一起。我们将拭目以待。



ref:
1 http://woodpecker.org.cn/abyteofpython_cn/chinese/
2 http://zh.wikipedia.org/wiki/Python
3 http://www.python.org/getit/



中国电子顶级开发网--电子设计论坛、博客、超人气的电子工程师资料分享平台k

点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 2

    粉丝
  • 1

    好友
  • 2

    获赞
  • 14

    评论
  • 3241

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-27 12:23 , Processed in 0.015261 second(s), 7 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部