"Fuzzing" In Python Can PREVENT Your Functions From FAILING

Sdílet
Vložit
  • čas přidán 28. 08. 2024
  • Have you heard of fuzzing? In this lesson we will be going over what it is, and how we can use it to make sure that our functions are robust and cannot be broken.
    ▶ Become job-ready with Python:
    www.indently.io
    ▶ Follow me on Instagram:
    / indentlyreels

Komentáře • 33

  • @xxyy1282
    @xxyy1282 Před rokem

    Thanks!

  • @christlebeau7848
    @christlebeau7848 Před rokem +1

    Hi I have a question, when you write:
    text:str="hello world"
    What does the ":" mean?
    Thanks in advance !

    • @Indently
      @Indently  Před rokem +1

      It’s syntax used for type hints

    • @christlebeau7848
      @christlebeau7848 Před rokem

      @@Indently tks but how does it work?

    • @neutrinoxicin6108
      @neutrinoxicin6108 Před rokem

      @@christlebeau7848 just tells u what data type is the variable is, read pep 0484

  • @kilatev
    @kilatev Před rokem

    Although it looks interesting approach, would it be better to use something like Hypothesis librarym that not only searches for inputs that may fail and provides that data, but also have some more tricks?

  • @federicobau8651
    @federicobau8651 Před rokem

    Good stuff and good example as it very simple and not opinioned so to show the concept. But would be nice if you show a real life scenario where to use i. For instance I dont think do this makes sense everywhere but only in some places /block of codes, but where it does yea , could save in apfront huge amunt of money to a company!

  • @spiralsight.7464
    @spiralsight.7464 Před rokem

    great work

  • @VojtechMach
    @VojtechMach Před rokem

    Correct me if Im wrong, but this concept doesnt seem very useful in practice because of its (possibly infinite) runtime (unless stop condition) and resource consumption. Testing functions with random inputs doesnt seem very systematic, since the tests will pass once and fail next time.
    If the inputs were not random, then maybe one is better of using some library for that, e.g. hypothesis.

  •  Před rokem

    Good shit! 😀

  • @SkyyySi
    @SkyyySi Před rokem +1

    Why are you using an int as a boolean value?

    • @aaronater1088
      @aaronater1088 Před rokem

      You can totally use int as a bool shorthand as they actually represent truthy/falsey values where True == 1, and False == 0. If you test that out, they do truly equal each other

    • @SkyyySi
      @SkyyySi Před rokem

      @@aaronater1088 "It's possible" isn't really an explanation of *why* you'd do it.

    • @aaronater1088
      @aaronater1088 Před rokem

      @@SkyyySi Well, I believe I did explain why, it's more of a "shorthand". Though, it would be more concise to use True/False. What he did is no different than replacing them with True or False. So question you asked is why do it then? Again, quick way of representing True or False. Different code bases have used that merely out of preference, and now if you spot that in code, you'll know what they doin. Of course, you'll need to evaluate the context what the code is doing, but yeh

  • @DrDeuteron
    @DrDeuteron Před rokem

    got enumerate?

  • @abdullatif3704
    @abdullatif3704 Před rokem

    Isn't better to just use
    ''.join(random.choices(characters, k=length))
    ?

    • @Indently
      @Indently  Před rokem +1

      I didn't really focus on optimisations during this video.
      If you can explain why you think it's better, I would love to hear about it?

    • @abdullatif3704
      @abdullatif3704 Před rokem +1

      I think it's better in readability, since both of them are doing the same thing I think it's also better to just use one that's already made for that job.
      Performance wise never really test it, most of the times it doesn't matter anyway.
      Also a question, I've seen your video about uuid and I'm interested in checking which one is better to do.
      I'm using the random generator, usually just with string.hexdigits to generate id for like ever. Most of the times it's for simple things but I do want to know, can I just use this or is there any problem with this method.

  • @LambdaCreates
    @LambdaCreates Před rokem +1

    Great video! Also, why are you STILL CHANGING THE PROFILE PICTURE? (by now most youtube channels would have stuck to a single icon)

    • @Indently
      @Indently  Před rokem +5

      Most channels do a lot of things, eventually I will hire a brand designer, and stick to one, but until then, no promises :)

  • @christlebeau7848
    @christlebeau7848 Před rokem

    Thanks but how do type hints work ?

    • @DrDeuteron
      @DrDeuteron Před rokem

      they don't. They just sit there are look annoying.

  • @Mywifeleftme3
    @Mywifeleftme3 Před rokem

    My corpse will be preserved in the cold my corpse will be preserved in the cold my corpse will be preserved in the cold my corpse will be preserved in the cold

  • @hemanth8195
    @hemanth8195 Před rokem

    next level bro 🤟🏾🤟🏾

  • @telebot
    @telebot Před rokem +1

    Hi, what editor is that?

    • @firstprinciples4078
      @firstprinciples4078 Před rokem

      fleet by jetbrains
      it's still in free preview phase

    • @EpicNoobx
      @EpicNoobx Před rokem +2

      @@firstprinciples4078 It's actually PyCharm by JetBrains.

    • @firstprinciples4078
      @firstprinciples4078 Před rokem

      @@EpicNoobx Oh thank you
      My mistake
      They do look kind of similar

    • @tzabarpho.
      @tzabarpho. Před rokem +1

      @@firstprinciples4078 yeah there is a new ui

    • @telebot
      @telebot Před rokem

      @@firstprinciples4078 Thanks!

  • @larseneivind
    @larseneivind Před rokem +1

    Well made! Great video.
    The historical reasons why this technique was invented is quite interesting as well. en.wikipedia.org/wiki/Fuzzing#History