Python 概述
Python是一种高级、解释性、交互式和面向对象的脚本语言。Python的设计目标是极易读懂。它经常使用英文关键词,而不是使用标点符号,相比于其他语言,Python的语法结构更简洁。
- Python是解释性的 - Python在运行时由解释器进行处理。您无需在执行之前编译程序。这与PERL和PHP类似。
-
Python是交互式的 - 您可以直接在Python提示符下与解释器交互编写程序。
-
Python是面向对象的 - Python支持面向对象的编程风格或技术,将代码封装在对象中。
-
Python是入门级语言 - Python是初级程序员的理想语言,并支持从简单文本处理到网页浏览器再到游戏等各种应用程序的开发。
Python是一种开源且跨平台的编程语言。它可以在所有主要操作系统平台(Linux、Windows和Mac OS)上使用Python软件基金会许可证(与GNU通用公共许可证兼容)进行使用。
Python的设计理念强调简洁、易读和明确。Python以“电池内置”的方式而闻名,因为Python软件附带了一个包含丰富函数和模块的标准库。
Python的设计理念在“Python之禅”中有所记载。其中包括19条格言,例如 –
- 美优于丑
- 明确优于隐晦
- 简单优于复杂
- 复杂优于晦涩
要获取完整的“Python之禅”文档,请在Python Shell中输入 import this 。
>>>import this
这将产生以下19个格言 –
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
Python支持命令式、结构化和面向对象的编程方法。同时也提供了函数式编程的特性。