lonestar-lemmy
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
other_cat@lemmy.zip to Programmer Humor@lemmy.worldEnglish · 3 months ago

Guess Carefully User

lemmy.zip

message-square
15
link
fedilink
428

Guess Carefully User

lemmy.zip

other_cat@lemmy.zip to Programmer Humor@lemmy.worldEnglish · 3 months ago
message-square
15
link
fedilink
alert-triangle
You must log in or register to comment.
  • Semperverus@lemmy.world
    link
    fedilink
    English
    arrow-up
    69
    ·
    3 months ago

    import os

    Instant goblin behavior.

  • brucethemoose@lemmy.world
    link
    fedilink
    English
    arrow-up
    50
    ·
    3 months ago

    Terrible code.

    os.remove does not remove folders, for that you want shutil.rmtree().

    Best to just do the user data folder since that’s where you have permission anyway.

  • lugal@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    32
    ·
    3 months ago

    Is that the test driven programming everyone talks about?

    • marcos@lemmy.world
      link
      fedilink
      English
      arrow-up
      21
      ·
      3 months ago

      Exactly. You write the tests first so you know exactly when not to remove Windows.

    • heavydust@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      5
      ·
      3 months ago

      That would be true if there were tests. If you work in banking or any other field with very specific specs and regulations, the program is almost perfect and answers the demands of the client.

      The undefined behavior is too much though, he should throw an exception instead.

  • qjkxbmwvz@startrek.website
    link
    fedilink
    English
    arrow-up
    21
    ·
    3 months ago

    Code doesn’t even pass the example test — mind your case sensitivity!

  • subignition@fedia.io
    link
    fedilink
    arrow-up
    13
    ·
    3 months ago

    doomed by case sensitivity

  • Troy@lemmy.ca
    link
    fedilink
    English
    arrow-up
    12
    ·
    3 months ago

    It’s that hacker 4chan again

  • daddy32@lemmy.world
    link
    fedilink
    English
    arrow-up
    9
    ·
    3 months ago

    I got once disqualified from a programming competition for including cases like that - and I was even nice enough to not include the os.remove thing!

  • satans_methpipe@lemmy.world
    link
    fedilink
    English
    arrow-up
    7
    arrow-down
    1
    ·
    3 months ago

    Localization dependent regex for this should be possible

  • MeatPilot@lemmy.world
    link
    fedilink
    English
    arrow-up
    5
    ·
    3 months ago

    Little Johnny “DROP TABLE ?” up to it again I see.

    • jbrains@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      9
      ·
      3 months ago

      *Bobby.

      • MeatPilot@lemmy.world
        link
        fedilink
        English
        arrow-up
        4
        ·
        3 months ago

        The boy ain’t right.

      • ByteJunk@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        3 months ago

        Oh yes. Little Bobby Tables we call him.

        https://xkcd.com/327

  • iAvicenna@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    3 months ago

    all he wanted was to get his cs101 hw done. all he got was computer reckt

Programmer Humor@lemmy.world

programmerhumor@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: !programmerhumor@lemmy.world
Visibility: Public
globe

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

  • 1 user / day
  • 2 users / week
  • 28 users / month
  • 1.08K users / 6 months
  • 1 local subscriber
  • 1.65K subscribers
  • 55 Posts
  • 51 Comments
  • Modlog
  • mods:
  • usr_bin_env@lemmy.world
  • BE: 0.19.11
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org