Skip to content

Bug: sep is ignored while printing when two adjacent values are either strings or integers #2677

Open
@kmr-srbh

Description

@kmr-srbh

The value of sep is ignored while printing when two adjacent values are strings.

print("a", "b", "c", "d", "e", sep="-")
(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py
abcde

The same is the case for integers.

print(1, 2, 3, 4, 5, sep=" is less than ")
(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py
12345

Please note that this is not an issue with the keyword argument itself. When two adjacent objects are necessarily not strings or integers, the value is used.

print(1, 2, 3, 4, 5, "a", "b", "c", [1, 2, 3, 4], sep="->")
(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py
12345abc->[1, 2, 3, 4]

The presence of a list leads to the usage of the separator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions