python 3.x - How do I know the type of a class variable before i create instance of it? -


some class example:

>>> import inspect >>> class test(object):         def test_method(self):             pass 

now, let's check type of varable class object:

>>> type(test.test_method) <class 'function'> 

nope. instance of class?

>>> test_var = test() >>> type(test_var.test_method) <class 'method'> 

yep, that's not want. let's try inspect module:

>>> inspect.ismethod(test_var.test_method) true >>> inspect.ismethod(test.test_method) false 

nope. why?


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -