Thanks to visit codestin.com
Credit goes to github.com

Skip to content

usability: int should default to i32 #1926

Closed
@rebcabin

Description

@rebcabin

The following compiles:

@dataclass
class StringIO:
    _buf     : str
    _0cursor : i32 = i32(0)
    _len     : i32 = i32(0)

if __name__ == '__main__':
    integer_asr : str = '(Integer 4 [])'
    test_dude   : StringIO = StringIO(integer_asr, 0, 15)
    assert test_dude._buf == integer_asr
    assert test_dude._len == 15

but, for usability, it should be

@dataclass
class StringIO:
    _buf     : str
    _0cursor : int = 0
    _len     : int = 0

if __name__ == '__main__':
    integer_asr : str = '(Integer 4 [])'
    test_dude   : StringIO = StringIO(integer_asr, 0, 15)
    assert test_dude._buf == integer_asr
    assert test_dude._len == 15

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions