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
Tru
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
--
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
[EMAIL PROTECTED] wrote:
> hello
> silly question, but i can't seem to figure it it.
>
> I have an object which is:
>
type(price)
>
>
> but i can't figure how to validate against it.
>
if not isinstance(price, decimal.Decimal):
>
On Wed, Nov 5, 2008 at 7:09 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> I have an object which is:
>
type(price)
>
>
> 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 havi
hello
silly question, but i can't seem to figure it it.
I have an object which is:
>>> type(price)
but i can't figure how to validate against it.
>>>if not isinstance(price, decimal.Decimal):
do something...
how do i ensure that the object 'price' is a decimal?
thanks