xin_fei_ 发表于 2018-8-12 10:38:16

谢谢群主的分享

solelysoar 发表于 2018-8-25 12:41:11

附带一个挺不错的举例的文章:
魔法方法(1)
魔法方法(2)

rtl1998 发表于 2018-8-27 10:13:46

感谢楼主无私奉献!

北城以北灬 发表于 2018-9-19 13:12:02

小甲鱼万岁

北城以北灬 发表于 2018-9-19 13:12:48

有这个真的太棒了

北城以北灬 发表于 2018-9-19 13:15:08

已经收藏了

汐影枫殇 发表于 2018-9-29 15:11:17

天!

sonichuang 发表于 2018-11-18 20:36:34

class Nstr(str):
    def __new__(cls, arg = ''):
      if isinstance(arg, str) and arg:
            a = arg.split(maxsplit = 1)
            arg = len(a )
            return str.__new__(cls, arg)
      else:
            print('Arguments\' type is wrong, must be string and length must at least one.')

    def __lt__(self, other):
      return int(self) < int(other)
    def __le__(self, other):
      return int(self) <= int(other)
    def __eq__(self, other):
      return int(self)== int(other)
    def __ne__(self, other):
      return int(self) != int(other)
    def __gt__(self, other):
      return int(self) > int(other)
    def __ge__(self, other):
      return int(self) >= int(other)

蛋疼的烤鸭 发表于 2018-12-17 10:37:15

0. 不会

1. 当前项没有对应的方法时

2.基类.____

3.

Lotus无忧 发表于 2018-12-24 04:39:47

慢慢玩转Python

wdye 发表于 2018-12-26 12:13:35

好东西 收藏一下,学习了

supertovy 发表于 2019-1-1 22:15:41

魔法方法 一时还比较难以理解啊~~{:10_266:}

Anonyq 发表于 2019-1-20 12:57:18

想知道这些怎么使用

haitao_matt 发表于 2019-2-13 16:13:57

我还在坚持学习,20190213

edge_man 发表于 2019-2-19 13:46:02

哇,太厉害了,这个

放梦的心 发表于 2019-3-16 15:47:10

感觉都不会

Roleplay 发表于 2019-3-18 20:00:42

小鱼鱼真优秀

无兮丶 发表于 2019-4-9 17:33:18

本帖最后由 无兮丶 于 2019-4-9 17:42 编辑

玩什么我调用int.__isub__会显示int中没有__isub__呢

w273268045 发表于 2019-4-16 00:11:39

666666666

lys93 发表于 2019-4-18 21:48:58

学习学习
页: 1 2 3 4 5 6 [7] 8 9 10 11
查看完整版本: Python 魔法方法详解