Skip to content

Why is length defined on numbers? #11769

Closed

Description

I discovered from a typo today that the length method is defined on numbers:

julia> length(5)
1

julia> length(pi)
1

It's defined here: https://github.com/JuliaLang/julia/blob/master/base/number.jl#L12. Why is length defined on numbers? This seems counterintuitive. Numbers aren't iterable in any way after all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions