<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><div><blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px; "><div class="yui_3_2_0_34_133553424105480"><div style="font-family: 'times new roman', 'new york', times, serif; "><font size="3">&gt; &gt; type(lambda : 0)</font><br><font size="3">&gt; &gt;</font><br><font size="3">&gt; &gt; is about as simple as you can do it with lambda...</font><br>&gt;<br><font size="3">&gt; ...I think there should be a type.function avaliable in python, like str, int, etc. exists.&nbsp;</font></div></div></blockquote><span style="font-family: 'times new roman', 'new york', times, serif;"><br></span>But there are many different function like objects just&nbsp;</div><div>as there are many different types of number. &nbsp;Python
 does&nbsp;</div><div>not have a type.number either.<br><div class="yui_3_2_0_34_133553424105480"><div class="yui_3_2_0_34_133553424105482"><font size="3"><br></font></div></div>Instead of<br><span style="font-family: 'times new roman', 'new york', times, serif;"><br></span><blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px; "><div class="yui_3_2_0_34_133553424105480"><div class="yui_3_2_0_34_133553424105482"><font size="3">&gt; isinstance(2, function)</font></div></div></blockquote>you can do:<br><br></div><div>callable(2)<br><span style="font-family: 'times new roman', 'new york', times, serif;"><br></span>which will check if 2 is any kind of callable object&nbsp;</div><div>- function, method, class etc.<br><span style="font-family: 'times new roman', 'new york', times, serif;"><br></span>That is usually much more useful that getting the
 type.<br><span style="font-family: 'times new roman', 'new york', times, serif;"><br></span>isinstance() does not of course return the type it tells&nbsp;</div><div>you if the object is an instance of the class or any&nbsp;</div><div>of its its subclasses:<br><span style="font-family: 'times new roman', 'new york', times, serif;"><br></span>&gt;&gt;&gt; class C: pass<br>...&nbsp;<br>&gt;&gt;&gt; class B(C):pass<br>...&nbsp;<br>&gt;&gt;&gt; c = C()<br>&gt;&gt;&gt; b = B()<br>&gt;&gt;&gt; isinstance(c,C)<br>True<br>&gt;&gt;&gt; isinstance(b,C)<br>True<br>&gt;&gt;&gt; isinstance(b,B)<br>True<br>&gt;&gt;&gt; isinstance(c,B)<br>False<br>&gt;&gt;&gt;&nbsp;<br><span style="font-family: 'times new roman', 'new york', times, serif;"><br></span>callable works the same way in that it tests whether you&nbsp;</div><div>can call the name. Which is usually all you care about.</div><div><br><blockquote style="border-left-width: 2px; border-left-style: solid;
 border-left-color: rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px; "><div class="yui_3_2_0_34_133553424105480"><div class="yui_3_2_0_34_133553424105482"><font size="3">&gt; Yes, I know that the pythonic way is to not define types in variables.&nbsp;</font></div><div class="yui_3_2_0_34_133553424105482"><font size="3">&gt; The variables are free while there is no assign to these. I need type because I want to implement&nbsp;</font></div><div class="yui_3_2_0_34_133553424105482"><font size="3">&gt; Tag as triple of name, type and value. I want to differentiate between a tag with type str and&nbsp;</font></div><div class="yui_3_2_0_34_133553424105482"><font size="3">&gt; value "today" and a tag with tag with type data and value "today".</font></div></div></blockquote><span style="font-family: 'times new roman', 'new york', times, serif;"><br></span>But why? Doing so will greatly reduce the flexibility of your&nbsp;</div><div>class.
 Far better to build&nbsp;Tag such that it works with any&nbsp;</div><div>object type.</div><div><br></div><div>Why would you need to know the type?</div><div>There are a very few scenarios where the type is genuinely&nbsp;</div><div>important (serialisation of data is one case) but in many&nbsp;</div><div>cases you just don't need to know.<br><div class="yui_3_2_0_34_133553424105480"><div class="yui_3_2_0_34_133553424105482"><br></div></div><span style="font-family: 'times new roman', 'new york', times, serif;">Alan G</span></div>   </div></body></html>