Skip to content

sum for tuples uses + #39182

Closed
Closed
@bkamins

Description

@bkamins

sum for tuples uses + which has the following two consequences:

  1. when a 1-element collection is passed + errors, while standard sum silently accepts the value:
julia> sum(["a"])
"a"
julia> sum(("a",))
ERROR: MethodError: no method matching +(::String)
  1. no promotion happens (as standard sum uses add_sum):
julia> sum([0xe1, 0x1f])
0x0000000000000100
julia> sum((0xe1, 0x1f))
0x00

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviormathsMathematical functionsstdlibJulia's standard library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions