As Python updating to python 3.6, its performance is better than Python 2.x, which is

good news to every Python developer. I would like to write down new features of Python 3.x,

I hope it can help me remind the history of Python development.

1.Python 3.0

1.1 Print Function.

We need to add bracket when invoking the print() function in Python.

1.2 Views And Iterators Instead of List.

dict methods dict.keys(), dict.items(). dict.values() return views instead of lists. For example,

 keys = d.keys(); keys.sort()

  this no longer works. Use k = sorted(d) instead.

map() and filter() return iterators.

range() behaves like xranges() but the latter no longer exists.

zip() return iterators.

1.3 Ordering Comparisons

The ordering comparison operators (<, <=, >=, >) raise a TypeError exception when the operands

do not have a meaningful natural ordering. (1 < '', 0 > None order len <= len are no longer valid.)

builtin.sorted() and list.sort() no longer accept the cmp argument providing a comparison function.

Use the key argument instead.

The cmp() function should be treated as gone, as the __cmp__() special method is not longer supported.

最新文章

  1. 随机数(random)
  2. 串口计时工具Grabserial简介及修改(添加输入功能)
  3. Eclipse DDT
  4. centos 6.7安装与配置vncserver
  5. Codeforces Round #169 (Div. 2)
  6. Swift使用注意
  7. 原生 js 模拟 alert 弹窗
  8. 6、java中的构造代码块
  9. 有关C#标签Attribute的熟悉
  10. Swift 注释
  11. linux使用脚本自动连接数据库
  12. hdu 4004 The Frog&#39;s Games
  13. (译) Angular运行原理揭秘 Part 1
  14. html_表单
  15. Handoff使用指南 - 理论篇
  16. 动态图片 gif
  17. Nancy 搭建
  18. java断言
  19. 【世外桃源】福音节目 swtychina.com
  20. Python实战之set学习笔记及简单练习

热门文章

  1. 记录css的常用属性
  2. code first 添加外键时,与原有的数据冲突ALTER TABLE 语句与 FOREIGN KEY 约束&quot;FK_XXXXX&quot;冲突
  3. .net中几个经常用到的字符串的截取
  4. Jmeter常用脚本开发之Debug Sampler
  5. linux通过speedtest-cli测试服务器网速
  6. hdu 1429 (bfs+状态压缩) 胜利大逃亡续
  7. How to install VCM 2 Ford IDS 109 software
  8. python下的MySQL数据库编程
  9. vs2015 npm list 更新问题
  10. Nowcoder 练习赛26E 树上路径 - 树剖