Using Decimal library results in compilation errors

Đang mở
#705 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, python
Lĩnh vực
compilers

Hướng nghiên cứu

Start with the example.py reproducer and run transcrypt -bn example.py, then inspect the linked output.txt for the compilation errors. Compare the result with the version that omits Decimal; done means the shown Decimal usage compiles to JavaScript without errors.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

IS: enhancement PRIO: 3 nice STATE: postponed

I've a need for accurate decimal values in my code, and thus attempted to utilize Python's Decimal module, but compilation fails when I attempt to run Transcrypt on it.

from decimal import Decimal
class Example:
    def __init__(self, value=Decimal('1.00')):
        self.value=value

My command line param is transcrypt -bn example.py

Dropping use of Decimal from this example compiles to JavaScript successfully.

Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin

MacOS Catalina (10.15.2)
Macbook Pro 13-inch 2016

output.txt

Ngôn ngữ chính
Python
Star
2.9k
Fork
218
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TranscryptOrg/Transcrypt

Tất cả issue của TranscryptOrg/Transcrypt

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.