Praise The Sun 𖤓
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
abhi9u@lemmy.world to Technology@lemmy.worldEnglish · 28 days ago

Python Performance: Why 'if not list' is 2x Faster Than Using len()

blog.codingconfessions.com

external-link
message-square
35
fedilink
104
external-link

Python Performance: Why 'if not list' is 2x Faster Than Using len()

blog.codingconfessions.com

abhi9u@lemmy.world to Technology@lemmy.worldEnglish · 28 days ago
message-square
35
fedilink
Discover why 'if not mylist' is twice as fast as 'len(mylist) == 0' by examining CPython's VM instructions and object memory access patterns.
  • ThirdConsul@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    27 days ago

    Honestly most people use Python because it has fantastic libraries

    In C++ if I remember correctly…

    Edit: I do https://codefinity.com/blog/Python-Libraries-Written-in-C-plus-plus

    • JustAnotherKay@lemmy.world
      link
      fedilink
      English
      arrow-up
      9
      ·
      27 days ago

      What do I care what language the library is written in as long as it works for what I need it do?

      • ThirdConsul@lemmy.ml
        link
        fedilink
        English
        arrow-up
        1
        ·
        27 days ago

        My point is tha the libraries itself are not in Python and thus most likely not exclusive to it. This is not an attack on Python, I just find it funny a bit :)

Technology@lemmy.world

technology@lemmy.world

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !technology@lemmy.world

This is a most excellent place for technology news and articles.


Our Rules


  1. Follow the lemmy.world rules.
  2. Only tech related news or articles.
  3. Be excellent to each other!
  4. Mod approved content bots can post up to 10 articles per day.
  5. Threads asking for personal tech support may be deleted.
  6. Politics threads may be removed.
  7. No memes allowed as posts, OK to post as comments.
  8. Only approved bots from the list below, this includes using AI responses and summaries. To ask if your bot can be added please contact a mod.
  9. Check for duplicates before posting, duplicates may be removed
  10. Accounts 7 days and younger will have their posts automatically removed.

Approved Bots


  • @L4s@lemmy.world
  • @autotldr@lemmings.world
  • @PipedLinkBot@feddit.rocks
  • @wikibot@lemmy.world
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 744 users / day
  • 2.47K users / week
  • 5.15K users / month
  • 10.4K users / 6 months
  • 1 local subscriber
  • 69.9K subscribers
  • 1.54K Posts
  • 8.44K Comments
  • Modlog
  • mods:
  • L3s@lemmy.world
  • enu@lemmy.world
  • Technopagan@lemmy.world
  • L4sBot@lemmy.world
  • BE: 0.19.8
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org