[Zope-dev] Asking for the type of a variable

Evan Simpson evan@4-am.com
Wed, 10 Nov 1999 15:31:29 +0000


Christopher Petrilli wrote:

> On 11/9/99 4:55 PM, David S. Harrison at dsh@magma-da.com wrote:

[snip]

>  <dtml-if "_.type(TAG)==_.type('x')">

Since I've hardly ever seen 'type' used *except* in this exact kind of
construction, how about a standard namespace function:

def same_type(a, b):
  return type(a) == type(b)

which would allow <dtml-if "_.same_type(TAG, 'x')">.  It could even be
extended to fall back to meta_type on ExtensionClasses, but it's nice and
simple as is.

Cheers,

Evan @ 4-am