Message147906
> + To check for a specific type (without including superclasses) use
> + :func:`assertIs(type(obj), cls) <assertIs>`.
>
> Don’t you mean “without accepting subclasses”, not superclasses?
I mean:
>>> class MyInt(int): pass # my specific type
...
>>> isinstance(MyInt(5), int) # int superclass included
True
>>> type(MyInt(5)) is int # int superclass not included
False
>>> type(MyInt(5)) is MyInt # check for specific type
True
Do you think I should rephrase it (or maybe just remove the (...))? |
|
Date |
User |
Action |
Args |
2011-11-18 17:15:33 | ezio.melotti | set | recipients:
+ ezio.melotti, georg.brandl, rhettinger, pitrou, eric.araujo, michael.foord, flox, docs@python, python-dev, eric.snow |
2011-11-18 17:15:33 | ezio.melotti | set | messageid: <1321636533.62.0.452991276521.issue13387@psf.upfronthosting.co.za> |
2011-11-18 17:15:33 | ezio.melotti | link | issue13387 messages |
2011-11-18 17:15:32 | ezio.melotti | create | |
|