ITPub博客

首页 > IT职业 > IT图书 > python中一些有意思的东西

python中一些有意思的东西

IT图书 作者:zuike2000 时间:2021-09-09 08:57:02 0 删除 编辑
a=3;b=3
print a is b                 #True
print a+3 is b+3             #True
print a+300 is b+300         #False

print type([])               #
print type(())               #
print type(([]))             #
print type(([(())]))         #

c = d = 4; c *= 4
print c is d                 #False
e = f = [4]; e *= 4
print e is f                 #True

print type({():()})          #
print type({[]:[]})          #TypeError: unhashable type: 'list'

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2203/viewspace-2798024/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: Python元类详解
请登录后发表评论 登录
全部评论

注册时间:2019-04-16

  • 博文量
    404
  • 访问量
    2062