public:it:python

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
public:it:python [2014/12/03 17:32] oakfirepublic:it:python [2024/01/15 15:33] (当前版本) – [Tips] oakfire
行 1: 行 1:
 ====== Python ====== ====== Python ======
   * [[https://www.python.org | Officail site: python.org]]   * [[https://www.python.org | Officail site: python.org]]
 +  * [[http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/tutorials/key_differences_between_python_2_and_3.ipynb | Key differences between python2 and 3]]
 ===== Tips ===== ===== Tips =====
   * 快速开一个静态http服务: 进入文件夹, 然后 ''python -m SimpleHTTPServer 80''   * 快速开一个静态http服务: 进入文件夹, 然后 ''python -m SimpleHTTPServer 80''
   * In Terminal, type ''pydoc raw_input'' Read what it says about "raw_input". If you're on Windows try ''python -m pydoc raw_input'' instead. Get out of pydoc by typing ''q'' to quit.   * In Terminal, type ''pydoc raw_input'' Read what it says about "raw_input". If you're on Windows try ''python -m pydoc raw_input'' instead. Get out of pydoc by typing ''q'' to quit.
-  * python为动态语言,与js类似, list,dict等object的''=''赋值在默认为引用.  拷贝list用''list2 = list1[:]''之后list2的改动与list1无关.+  * python为动态语言,与js类似, list,dict等object的''=''赋值在默认为引用. 如果不需要引用, 那么拷贝list用''list2 = list1[:]'',之后list2的改动便与list1无关. 
 +  * python 变快的 9 个技巧:[[https://medium.com/techtofreedom/9-subtle-tricks-to-make-your-python-code-much-faster-50be6dd69a30|9-subtle-tricks-to-make-your-python-code-much-faster]] 
 +    * 拼接字符串的速度, 直接 ''+'' 快于  ''join()'' 快于 ''+='' 一项项加. 
 +    * Faster List Creation: Use “[]” Over “list()” 用 ''[]''来初始化列表 
 +    * Faster Membership Testing: Use a Set Over a List 
 +    * Faster Data Generation: Use Comprehensions Over For Loops  用内包代替循环 
 +    * Faster Loops: Prioritize Local Variables 优先使用局部变量 
 +    * Faster Execution: Prioritize Built-In Modules and Libraries 优先用内置模块和库 
 +    * Faster Function Calls: Leverage Cache Decorator for Easy Memoization   
 +    * Faster Infinite Loop: Prefer “while 1” Over “while True” 但是现代解释器基本都优化过, ''while TRUE'' 还更有可读性 
 +    * Faster Start-Up: Import Python Modules Smartly 
 ===== 从零开始 ===== ===== 从零开始 =====
-  * [[http://learnpythonthehardway.org/book/ | learn python the hard way]]+  * [[http://learnpythonthehardway.org/book/ | learn python the hard way]] python2.
   * Learning more:   * Learning more:
       * [[http://learnrubythehardway.org/|Learn Ruby The Hard Way]] You will learn even more about programming as you learn more programming languages, so try learning Ruby too.       * [[http://learnrubythehardway.org/|Learn Ruby The Hard Way]] You will learn even more about programming as you learn more programming languages, so try learning Ruby too.
  • public/it/python.1417599144.txt.gz
  • 最后更改: 2014/12/03 17:32
  • oakfire