search

Home  >  Q&A  >  body text

python里的双下划线函数都是什么意思?

__module__
__new__
__reduce__
__repr__
__reduce_ex__
__getattribute__
ringa_leeringa_lee2807 days ago994

reply all(4)I'll reply

  • 怪我咯

    怪我咯2017-04-17 17:39:23

    Look here

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 17:39:23

    http://rafekettler.com/magicmethods.html

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 17:39:23

    Hide attributes or methods.

    such as

    >>> '33'.__hash__()
    4038753864587545164
    >>> '33'.__len__()==len('33')
    True
    
    
    >>> (3).__pow__(2)
    9
    
    >>> int.__pow__(3,2)
    9

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 17:39:23

    Simply put, it’s a hook.

    reply
    0
  • Cancelreply