[Python-ideas] add __contains__ into the "type" object
语言破碎处
mlet_it_bew at 126.com
Tue Feb 28 18:02:23 EST 2017
where we use types?
almost:
isinstance(obj, T);
# issubclass(S, T);
Note that TYPE is SET;
if we add __contains__ and __le__ into "type",
then things become:
obj in T;
# S <= T; # if only not misleading to a total ordering
example:
def __getitems__(self, i):
if i in Integral:
...
elif i in slice:
...
# Save "(,)". Really, I prefer to type "lambda:;" than "()".
# I fail to modify the "type" object, since it is a C-object.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170301/7fdea4a2/attachment.html>
More information about the Python-ideas
mailing list