Why does `type(myField)` return `<type 'instance'>` and not `<type 'Field'>`?
<p>I am confronted to a python problem. I want to use <code>type()</code> to find out what type of variable I am using. The code looks similar to this one:  </p>

<pre><code>class Foo():
       array=[ myField(23),myField(42),myField("foo"), myField("bar")]
       def returnArr(self):
          for i in self.array:
               print type(i)

if __name__ == "__main__":
    a=Foo()
    a.returnArr()
</code></pre>

<p>Edit: myField() is a class I defined.</p>

<p>When I ask for the type() I get:  <code>&lt;type 'instance'&gt;</code> Now according to <a href="http://docs.python.org/reference/datamodel.html" rel="nofollow">1</a> this is due to the fact that I use a class element and ask for <code>type()</code> on that. Now what I need is: <code>&lt;type 'int'&gt;</code> for the example: <code>myField(42)</code> and <code>&lt;type 'str'&gt;</code> for <code>myField(foo)</code>. How could I acheive that?</p>

<p>EDIT:</p>

<pre><code>def __init__(self, name, default, fmt="H"):
    self.name = name
    if fmt[0] in "@=&lt;&gt;!":
        self.fmt = fmt
    else:
        self.fmt = "!"+fmt
    self.default = self.any2i(None,default)
    self.sz = struct.calcsize(self.fmt)
    self.owners = []
</code></pre>

<p>The code is taken from scapy and I try to adapt it.</p>
