fstab
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
alphacyberranger@lemmy.world to Programmer Humor@programming.devEnglish · 2 years ago

More the merrier

lemmy.world

message-square
77
fedilink
1.23K

More the merrier

lemmy.world

alphacyberranger@lemmy.world to Programmer Humor@programming.devEnglish · 2 years ago
message-square
77
fedilink
  • mashbooq@infosec.pub
    link
    fedilink
    arrow-up
    14
    ·
    2 years ago

    Also me when I’m forced to write documentation for a Python function

    def delete_first_of_list(the_list: list):
    
    • coloredgrayscale@programming.dev
      link
      fedilink
      arrow-up
      7
      ·
      2 years ago

      What if I pass an empty list, or NoneType?

    • RagingRobot@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      2 years ago

      Does this return a new list or modify the original? I would hope it returns a new one but I would know for sure if there was documentation.

      • kablammy@sh.itjust.works
        link
        fedilink
        arrow-up
        4
        ·
        2 years ago

        I would hope it modifies the original. It’s implied in the name. A function that returns all but the first item should be named something like tail or without_first_item.

    • stilgar [he/him] @infosec.pub
      link
      fedilink
      arrow-up
      3
      arrow-down
      1
      ·
      2 years ago

      This is a good way to realise that you don’t need a function for that use case.

      • coloredgrayscale@programming.dev
        link
        fedilink
        arrow-up
        3
        ·
        2 years ago

        If they need it often it makes some sense, if it also perform some checks, if the list if empty or None/null.

Programmer Humor@programming.dev

programmer_humor@programming.dev

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: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

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

  • 838 users / day
  • 4.66K users / week
  • 9.21K users / month
  • 17.8K users / 6 months
  • 3 local subscribers
  • 23.1K subscribers
  • 1.41K Posts
  • 51.9K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.5
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org