Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • +1: After all, decimal.Decimal and fractions.Rational often works where you've so carefully checked for int. Type checking in advance prevents legal, appropriate use. It doesn't prevent any problems. Commented Aug 17, 2010 at 11:05
  • 1
    I had a variable in a dictionary so have to do a type check in this case Commented Aug 17, 2010 at 12:06
  • 2
    @Hulk: Why is that case special? Commented Aug 17, 2010 at 12:17
  • 3
    @Hulk: "if value of the variable is not a integer then not to process further" Best handled by exception surrounding the loop. This does not need any type checking. Commented Aug 17, 2010 at 14:20
  • 1
    isinstance(False, int) True Commented Oct 3, 2019 at 14:15