1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] ValueError: Exceeds the limit (4300) for integer string conversion

Discussão em 'Python' iniciado por Stack, Outubro 8, 2024.

  1. Stack

    Stack Membro Participativo


    >>> import sys
    >>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.
    >>> _ = int('2' * 5432)
    Traceback (most recent call last):
    ...
    ValueError: Exceeds the limit (4300) for integer string conversion: value has 5432 digits.​

    Python 3.10.7 introduced this breaking change for type conversion.

    Documentation: Integer string conversion length limitation

    Actually I don't understand why

    1. this was introduced and
    2. where does the default value of 4300 come from? Sounds like an arbitrary number.

    Continue reading...

Compartilhe esta Página