On Wed, Nov 5, 2008 at 7:09 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> I have an object which is:
>
>>>> type(price)
> <class 'decimal.Decimal'>
>
> but i can't figure how to validate against it.
>
>>>>if not isinstance(price, decimal.Decimal):
>          do something...

This should work, what problem are you having?

> how do i ensure that the object 'price' is a decimal?

Why do you need to know? Another approach is to just treat it as a
Decimal and catch the exception that is raised if it is not.

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

Reply via email to