Check Variable Type in Server Script

How to check for variable type in server script? The python type() function cannot be used (it returns “NameError: name ‘type’ is not defined”), both in server script and in system console. Any other ways to check?

P.S. the current variable type by by that line of code, I know that python can change variable type when new value is assigned

@scratching_head what exactly you want to accomplish ?

I want to know the variable type of the values that I get using server script, such as:

cur_idx = None
for item in items:
    cur_idx = item.idx
    frappe.msgprint(str(type(cur_idx)))

I want to know whether it is a string, None, int, or is there anything more (such as javascript null), and it is not only for idx but anything else that I can possibly need. How can I accomplish that?

you can use : isinstance(cur_idx, str)
return value => true / false
instead of str you may also use int, float etc.