benoitc / benoitc/couchdbkit

Strange Decimal behaviour in ListProperty

Open
#95 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
263
Forks
90
PR merge metrics
No merged PRs in 30d

Description

```
>>> from decimal import Decimal
>>> from couchdbkit import *
>>> class A(Document):
... prices = ListProperty()
...
>>> a = A()
>>> a.prices.append(Decimal('22.44'))
>>> a.prices.append(Decimal('67.87'))
>>> a.prices.append(Decimal('22.44'))
>>> a.prices
[u'22.44', Decimal('67.87'), u'22.44']
```

Why is a Decimal with 22.44 coming up as unicode, and other Decimals with different values coming up as the actual object? I have tried to use item_type property, but this does help anything.
This isn't consistent behaviour!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.