• @ishanpageOP
    link
    English
    31 year ago

    OTOH, the more pythonic one will probably perform worse, but I’m not familiar enough with Python internals to make that claim without benchmarks.

    I’ll try it out and add the data in the article

    • @[email protected]
      link
      fedilink
      English
      41 year ago

      Eh, the python one will probably perform better, because sum is probably written in native C under the hood.

      • @jadero
        link
        English
        31 year ago

        I’ve yet to find a language where “doing it yourself” has higher performance than calling the built-in or library function. There are edge cases, but rarely enough to be bothered about.