19. Sample code quick q


#1

Hi, just a quick question about the sample code in section 19 (the final section) of functions - is it right?

What would this bit do? Is it checking the type and returning at the same time or something?

def is_numeric(num):
    return type(num) == int or type(num) == float:

#2

Is bumping allowed on this forum? Couldn't see it forbidden and I'm still interested in an answer to my question, so I'm bumping this. Any answers to my original q?


#3

Bumping is not prohibited, as least not in a case such as this where you are still awaiting answer. It would be considered on a case by case basis.

The expression is evaluated, first, then the yield gets returned. The return value will be a boolean.

We would not have a colon in this statement.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.