John Fouhy wrote:
2008/11/6 Brian Lane <[EMAIL PROTECTED]>:
But you could also compare it to a known type:

if not type(price) is type(decimal.Decimal(0)):
 print "Not Decimal"

Easier to just compare with decimal.Decimal:

import decimal
d = decimal.Decimal(13)
type(d) == decimal.Decimal
True

And since classes are singletons, you can use 'is' instead of '=='.


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to