Is this a good idea or a waste of time?
sjdevnull at yahoo.com
sjdevnull at yahoo.com
Mon Aug 28 18:06:02 EDT 2006
Antoon Pardon wrote:
> There seem to be enough problems that work with ints but not with
> floats. In such a case enforcing that the number you work with
> is indeed an int seems fully appropiate.
I've _never_ seen a case where enforcing types in the manner of the OP
is appropriate.
It fails with trivial wrappers like
class myInt(int):
def printFormatted(self):
..........
Even looser checking with isinstance is rarely right. You may want to
exclude floats, but that doesn't mean you want to exclude int-like
objects that don't inherit from int.
More information about the Python-list
mailing list