You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
305 B
22 lines
305 B
# test containment operator on subclass of a native type
|
|
|
|
class mylist(list):
|
|
pass
|
|
|
|
class mydict(dict):
|
|
pass
|
|
|
|
class mybytes(bytes):
|
|
pass
|
|
|
|
l = mylist([1, 2, 3])
|
|
print(0 in l)
|
|
print(1 in l)
|
|
|
|
d = mydict({1:1, 2:2})
|
|
print(0 in l)
|
|
print(1 in l)
|
|
|
|
b = mybytes(b'1234')
|
|
print(0 in b)
|
|
print(b'1' in b)
|
|
|