A crucial difference between a set and a type is that you cannot
explicitly iterate over the elements of a type, so while we could implement

x in int

to do something useful, we cannot make

for x in int:
   print(x)

Because if we could, we could implement Russell's paradox in Python:

R = set(x for x in object if x not in x)

print(R in R)

Bottom line: a set is not a type, even in mathematics.

Stephan


2017-03-02 5:38 GMT+01:00 Pavol Lisy <[email protected]>:

> On 3/1/17, Steven D'Aprano <[email protected]> wrote:
> > On Wed, Mar 01, 2017 at 07:02:23AM +0800, 语言破碎处 wrote:
> >>
> >> where we use types?
> >>     almost:
> >>         isinstance(obj, T);
> >>         # issubclass(S, T);
> >>
> >> Note that TYPE is SET;
> >
> > What does that mean? I don't understand.
>
> Maybe she/he wants to say that it is natural to see class as a
> collection (at least in set theory
> https://en.wikipedia.org/wiki/Class_(set_theory) )
> _______________________________________________
> Python-ideas mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to