How to Make Your Python Code More Modular and Reusable

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ธ.ค. 2024

ความคิดเห็น • 22

  • @timothynewton5231
    @timothynewton5231 8 หลายเดือนก่อน +10

    Subbed. I wish I had found this 3 years ago when I was first getting started. Hopefully someone newer will stumble across your work and find your work helpful.

    • @the_code_guy
      @the_code_guy  8 หลายเดือนก่อน

      Thanks for the kind words, the support and for watching!

  • @souravbarua3991
    @souravbarua3991 3 หลายเดือนก่อน +1

    Very helpful. Thank you for this.

    • @the_code_guy
      @the_code_guy  3 หลายเดือนก่อน

      Gald it helped. Thanks for watching!

  • @fiedeldoo
    @fiedeldoo 3 หลายเดือนก่อน +1

    Great video. I like that you didnt cut out the mistake. This shows that making not everything perfect at the first glance is normal.
    The inly thing i am missing ist the explanation what the __init__.py is for.
    You said you would recommend adding an extra file for the function, but why? That would be interesting.
    Thank you.

    • @the_code_guy
      @the_code_guy  3 หลายเดือนก่อน

      Glad you like it. The mere presence of __init__.py tells python that the folder is a package. When you import the package any functions in __init__.py will be executed and made avaialble to your code. You may not want to use all thew functionality of a package and so putting them in sub files lets you import just what you need, which is fater.
      Hope this helps and Thanks for watching!

  • @Robert256
    @Robert256 8 หลายเดือนก่อน +4

    I am one of these new-to-python viewers. Most of this made sense to me. What environment are you programming in? The one I was introduced to doesn't have the autocomplete feature nor the highlighting of similar arguments, etc...

    • @the_code_guy
      @the_code_guy  8 หลายเดือนก่อน +3

      I am using pycharm Community in these videos. For me Pycharm is by far the best IDE i've ever used. Thanks for watching!

    • @Robert256
      @Robert256 8 หลายเดือนก่อน +1

      Thank you, I will check it out!@@the_code_guy

  • @MuhanadAbulHusn
    @MuhanadAbulHusn 5 หลายเดือนก่อน +1

    The way you explained it is really awesome 👌

    • @the_code_guy
      @the_code_guy  5 หลายเดือนก่อน +1

      Glad you liked it. Thanks for watching!

  • @guocity
    @guocity 5 หลายเดือนก่อน +2

    How to share package with other python files in OS level?

    • @the_code_guy
      @the_code_guy  5 หลายเดือนก่อน +1

      You would have to install it as a python external packge into python or your venv . There are several ways to do it. Host your own pip server or do a local pip install.
      Pycharm makes it prety easy if you just want to do it locally. www.jetbrains.com/help/pycharm/creating-and-running-setup-py.html
      If you want to install in a new venv pip install -e
      This is a pretty advanced subject. I can add to my future video list if you would like me to cover. Thanks for watching!

    • @MuhanadAbulHusn
      @MuhanadAbulHusn 5 หลายเดือนก่อน +1

      It would be useful indeed. Personally, I upload my packages to Github and clone it from there

  • @vvkthegreatest
    @vvkthegreatest 6 หลายเดือนก่อน +3

    Very useful.nthanks

    • @the_code_guy
      @the_code_guy  6 หลายเดือนก่อน

      Glad you found it useful. Thanks for the support!

  • @somethingdarkinside
    @somethingdarkinside 6 หลายเดือนก่อน +2

    Your voice sounds familiar, hmmm

    • @the_code_guy
      @the_code_guy  6 หลายเดือนก่อน

      I also make content on a certain action RPG or something else?

    • @somethingdarkinside
      @somethingdarkinside 6 หลายเดือนก่อน +1

      @@the_code_guy that might be it.

    • @the_code_guy
      @the_code_guy  6 หลายเดือนก่อน

      Thanks for coming over. Hope you find it useful!

  • @dab_u7185
    @dab_u7185 2 หลายเดือนก่อน +1

    42 😂

    • @the_code_guy
      @the_code_guy  2 หลายเดือนก่อน

      It shows up all over the place. For good reason... It is the answer to life, the universe and everythinhg.