zoukankan      html  css  js  c++  java
  • What's New In Python 3.X

        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.

       

  • 相关阅读:
    CSS基础知识点
    HTML回顾
    stringbuffer与stringbuilder与String
    事务的概念与使用
    大数据处理对象CLOG BLOG
    小却常用的小知识点和技巧
    视图
    移位运算符
    规范化与范式
    聚集索引和非聚集索引
  • 原文地址:https://www.cnblogs.com/zhuangzebo/p/6397152.html
Copyright © 2011-2022 走看看