5 Python tricks that will improve your life

Поділитися
Вставка
  • Опубліковано 7 січ 2025

КОМЕНТАРІ • 458

  • @inigo8740
    @inigo8740 4 роки тому +576

    This guy: pdb
    Me: print

    • @irend1163
      @irend1163 4 роки тому +56

      def my_func(number):
      if number + 2 == 4:
      print("program is running baby")
      else:
      print("your code suck")
      my_func(2)
      Run the program,
      Your code suck
      Me : *what the hell happened here*

    • @OmarKhaled-ld5ur
      @OmarKhaled-ld5ur 4 роки тому +3

      @@irend1163 you sure it didn't work
      cause i did the same and it worked

    • @irend1163
      @irend1163 4 роки тому +15

      @@OmarKhaled-ld5ur it just joke man, of course it's a working code

    • @zyz1153
      @zyz1153 4 роки тому +1

      Inigo Diaz use pycharm to make it easier

    • @kanva4
      @kanva4 4 роки тому

      @@OmarKhaled-ld5ur woooosh

  • @sandervanrijn3442
    @sandervanrijn3442 4 роки тому +186

    0:48 - The interactive shell (python -i file.py)
    1:49 - Python Debugger (import pdb - standard library)
    2:56 - Virtual Environments
    4:19 - List and Dictionary comprehensions
    6:34 - Lambda functions

  • @baphnie
    @baphnie 3 роки тому +9

    Don’t fall into the trap of rating code by counting lines (re: list comprehension). Your code ought to be efficient, but MUST be readable. The best code is that which future peers can read reasonably quickly.

  • @saminchowdhury7995
    @saminchowdhury7995 5 років тому +71

    Production quality is amazing.
    Thank you brother.

  • @mateuszkolpa
    @mateuszkolpa 5 років тому +99

    It's depreciated by PEP8 to assign lambda functions. They are mainly used for stuff like this:
    tuples = [(1, 5), (1, 3), (1, 4)]
    tuples.sort(key=lambda x: x[1])
    print(tuples)
    OUTPUT:
    [(1, 3), (1, 4), (1, 5)]
    For 1 line functions do:
    def add(a, b): return a + b

    • @tobiaswegener1234
      @tobiaswegener1234 4 роки тому +1

      Interesting thanks for the info!

    • @TheJobCompany
      @TheJobCompany 4 роки тому +2

      It's against PEP8 to not put a newline after a ":", so you would have to do it in 2 lines.

    • @TimoKvapil
      @TimoKvapil 4 роки тому

      I know that this might be a stupid question for you (I AM A BIG NOOB) But is it possible to recreate this sorting thingy, without actually using lambda. I mean using only functions. (we can't use lambda at school)

    • @M15t4r1pP4
      @M15t4r1pP4 4 роки тому +1

      Timotej Kvapil
      Depends on what you mean. If you’re asking about sorting a list using the key parameter and a lambda, then yes, that is doable.

    • @soundcore183
      @soundcore183 4 роки тому +1

      lambda can be used in commands for gui elements adding values without to specify a global function. Look at it like a list comprehension inside a function taking x and making basic operations without a function name. The difference to def i think it doesn't create an object or dict in general for exuting the function header like calling eval. Most of the object types in python are hidden dictionaries. Generators and annotators weren't mentioned.

  • @phoehtaung
    @phoehtaung 5 років тому +300

    For those asking what font
    Dank Mono
    What IDE/Text Editor?
    VSCode
    What theme?
    Material Theme

    • @MrChickenpoulet
      @MrChickenpoulet 4 роки тому +8

      Hey thanks for that

    • @zephyr7
      @zephyr7 4 роки тому +2

      I was just gonna ask that

    • @linusbrendel
      @linusbrendel 4 роки тому

      Thank you very much ♥️

    • @InarusLynx
      @InarusLynx 4 роки тому +1

      A man after my own heart. A man of culture and fine taste. Excellent choice for theme.

    • @LavakeshPandey
      @LavakeshPandey 4 роки тому

      Dank Mono costs £40.

  • @berkaykurkcu
    @berkaykurkcu 5 років тому +3

    For Windows 10 using PyCharm with Python 3.7.6 , when you initialize a virtual environment "virtualenv venv" in PyCharm Terminal on your project, new folder containts "Include,Lib,Scripts,tcl and Readme.txt" , no /bin/. What you can do is cd to Scripts and then just type "activate" . should do it.

  • @ahmedalgrai
    @ahmedalgrai 5 років тому +16

    I'm just glad that I found this channel.

  • @givdb5513
    @givdb5513 3 роки тому +1

    Excellent vide, better than the majority of UA-cam videos.
    What I really need actually for now it's a complete semantic, syntax explanation of Python and languages in general

  • @tmiae0
    @tmiae0 5 років тому +7

    Great video, keep 'em coming!

  • @marcoscz7858
    @marcoscz7858 5 років тому +2

    Amazing, strait to the point videos. Keep them coming!

  • @claymcclendon
    @claymcclendon 4 роки тому +7

    I am taking a python class rn and this is extremely helpful! Wish I knew this a couple weeks of ago.

  • @bikerkid975
    @bikerkid975 5 років тому +1

    Loving the increase in video efficiency and overall creativity and style. Keep it up! Cheers from Montréal

  • @8ctrl763
    @8ctrl763 5 років тому +29

    The editing and the content is absolutely amazing
    (P.S - need more videos like the tinder bot may be post a building a bot or something once a week)

  • @bradylange
    @bradylange 3 роки тому +1

    This is extremely useful! I develop a lot with Python and had no idea about the interactive shell or the Python Debugger. Thank you!

  • @TubularAnimator
    @TubularAnimator 2 роки тому +1

    I love your channel. Been subscribed for a long time.

  • @andre-barrett
    @andre-barrett 4 роки тому +2

    Awesome tips and tricks. I'm not a Python developer but I've been a software engineer for 20+ years. Let's keep sharing the knowledge

  • @sasukesan96
    @sasukesan96 5 років тому +9

    You are my favorite youtuber, thank you so much for teaching us all that stuff. This channel is truly underrated.

  • @gabrielh5105
    @gabrielh5105 4 роки тому +12

    Wow, the edition of this video is incredible. The transitions, the camera, the light, the animations, wow. You have escalated a lot. From English teacher, passing through software developer, to a great content creator. Keep it up.

    • @sausas8209
      @sausas8209 Рік тому

      I agree! Quick intro, cool but not too long or annoying splash, to the point tips and great screen capture only containing the necessary information !

  • @CordonbleuZz
    @CordonbleuZz 4 роки тому +4

    List comprehensions are very powerful!
    i've seen it in Haskell (functional programming language) where you could write quicksort in 2 lines

    • @chaddaifouche536
      @chaddaifouche536 3 роки тому

      List comprehension actually originates from Haskell, Guido was inspired by its syntax (and adapted that to Python). Of course list comprehensions in Haskell have their origin in set comprehension in Mathematics.

  • @FrootNinja
    @FrootNinja 4 роки тому

    Your production value in your video has gotten better I love the new setup

  • @JayTeaFTW
    @JayTeaFTW 5 років тому

    For sure my new favorite channel

  • @somiljain7670
    @somiljain7670 5 років тому +3

    Thanks! for sharing these tips :)

  • @riteshbhartiya6155
    @riteshbhartiya6155 4 роки тому +2

    You made my life so easy, and effortless 🎶

  • @gulshankumar17
    @gulshankumar17 4 роки тому +8

    wow, thanks man. Python is really great. Yesterday I was given some excel sheets to work. Instead of doing it manually I use python pandas library.

    • @irend1163
      @irend1163 4 роки тому

      What do you need to do with excel sheets?
      And how do you work it automatically with python?

    • @AU24097
      @AU24097 2 роки тому

      @@irend1163 he’s probably reading the excel sheet and converting it into a pandas dataframe.

  • @JulienReszka
    @JulienReszka 5 років тому +1

    Not even 2 minutes of video and already learned something great. Thanks

  • @kaczordonald1426
    @kaczordonald1426 5 років тому +4

    I learned something new. Thanks!

  • @igorthelight
    @igorthelight 3 роки тому +2

    Just remember guys: less code != cleaner code

  • @lpdc9767
    @lpdc9767 5 років тому

    Very good quality and channel consistency. Thanks for the tips.

  • @iliqnew
    @iliqnew 4 роки тому +14

    5:29 I think there is a more simple way.
    list(fruits.keys())
    list(fruits.values())

    • @RiedlerMusics
      @RiedlerMusics 4 роки тому +1

      yes, he just wanted an example to show how list comprehensions work.

    • @clarianken4223
      @clarianken4223 4 роки тому

      @Iliyan
      what is that technique called?
      pls explain how it works?

  • @mike_kravchenko
    @mike_kravchenko 5 років тому +178

    WHAT IS INSIDE OF FOLDER "RUSSIA"?

    • @sickofit1304
      @sickofit1304 4 роки тому +1

      I want to know that too..

    • @UlfKlose
      @UlfKlose 4 роки тому +5

      It says “RussiaN”. I guess he’s learning the Russian language or something.

    • @skynet1024
      @skynet1024 4 роки тому

      maybe its
      how to ask for mercy in russian
      (if ww3 happens)

    • @Turco949
      @Turco949 4 роки тому

      It will be in another video.

    • @shayantej651
      @shayantej651 4 роки тому +4

      Russian Nuclear Hacking codes😂😂😂😂

  • @vinni113
    @vinni113 3 роки тому

    Really great video! I've been using python for a while but learnt some new things so thanks!

  • @depressedknight369
    @depressedknight369 3 роки тому

    this is really so helpful, always. Whether I revise things just for my knowledge sake or preparing for an insterview, I go through this video for sure.

  • @Circumvenscion
    @Circumvenscion 4 роки тому

    Love your vids man. Great tips, thank you!

  • @dinesh.p8642
    @dinesh.p8642 3 роки тому +1

    your voice is nice and smooth. You are a legend!

  • @muhammadahmedjaved7691
    @muhammadahmedjaved7691 5 років тому +1

    Your videos are always very awesome and informative
    I always watch whenever they are released
    a lot of people don't yet know how good you and your video are
    you will get a lot of subscriber in near future if you continue to produce these awesome videos

  • @wouldbealex
    @wouldbealex 4 роки тому +1

    anaconda with a jupyter notebook makes debugging in-line. Then the code can either be run externally against the notebook or export the code to a py script. Conda also allows for multiple environments. With each environment, the developer can install whatever is best or required for that environment (e.g., _r-mutex and r-base in one env and Microsoft MOR in another without conflicts between libraries/packages. Otherwise, great starter video. Dictionaries or any other form of collection that can be traversed without array interactions is really important in all languages. Lamda and filter are great!

  • @Francois3k
    @Francois3k 5 років тому +26

    Were did u go learn all your animation you put in the videos? cause it looks firee. If you can, can you tell me what courses you use an the resource cause that would be awesome 😊😊😊

  • @grantwilliams630
    @grantwilliams630 4 роки тому +1

    I’d recommend conda environments over virtualenv if you plan on using math or statistical libraries anyway. Conda’s numpy installation comes with Intel’s MKL and is worth using

  • @Shadowhuntazz
    @Shadowhuntazz 5 років тому +1

    As a python beginner, this is a nice and truly useful vid man, thanks 😉

  • @felixk2129
    @felixk2129 3 роки тому

    Awesome, thanks a lot!

  • @kalanachamath
    @kalanachamath Рік тому

    Thanks man!

  • @douglasm1494
    @douglasm1494 4 роки тому

    Thanks for the tips Shaggy

  • @fusrusty253
    @fusrusty253 5 років тому

    Well done!! Love your videos!!

  • @jaykim7161
    @jaykim7161 4 роки тому

    Thank you Aaron

  • @raf6125
    @raf6125 4 роки тому

    Thank you. This was really useful

  • @matrixv01
    @matrixv01 5 років тому +1

    Awesome videos. Keep it up!

  • @shivams417
    @shivams417 4 роки тому

    comprehensions and lambdas, filters, map are usually ignored in python, which actually very useful if used in right ways. Useful video man, keep em coming ! Thanks

  • @luis96xd
    @luis96xd 5 років тому

    Thanjs for all this tricks and tips!

  • @refaiabdeen5943
    @refaiabdeen5943 4 роки тому

    Cheers Mate !

  • @anaximeno
    @anaximeno 4 роки тому

    Usefull for sure!

  • @hkn5539
    @hkn5539 4 роки тому

    Awesome. Thanks bro.

  • @alikaperdue
    @alikaperdue Рік тому

    @4:58 -> perl doing python list comprehension
    @fruit_names = map($_->{name}, @fruits);
    Syntax is a little different, but the meaning is the same.
    Perl can collect data from structures in one line too and before python.
    Data structure would be nearly the same:
    @fruits = (
    { name => 'apple', price => 20},
    { name => 'avocado', price => 10},
    { name => 'orange', price => 5},
    );
    For only fruits beginning with "a":
    @fruit_names = grep(/^a/, map($_->{name}, @fruits));
    For a new dict using names as keys and prices as values:
    %new_fruits = map(($_->{name},$_->{price}), @fruits);
    Perl is old stuff now, but it had some cool features. I'm glad to see Python implementing and improving on Perl ideas.
    But "list compression" is just a name for something that appears in other languages without the moniker. Or it exists in Perl without an official name. We called these things: "one liners"

  • @_gpop
    @_gpop 5 років тому +2

    List comprehensions changed my life. I should probably be working more in virtual environments though.

  • @codecat8430
    @codecat8430 4 роки тому

    Great stuff!

  • @jrwkc
    @jrwkc 5 років тому

    bruh, ya using VSCode and then also using pdb inside of it. That's putting a hat on a hat. The debugger in VScode is life changing.

  • @eesakamaldien1917
    @eesakamaldien1917 4 роки тому

    Just subscribed. This video is so helpful

  • @atrus3823
    @atrus3823 3 місяці тому

    Good list, though I find I pretty much never end up using lambdas. The syntax is so verbose, and not that clear, and for most list operations, a generator expression is shorter and clearer. For example (x for x in [1, 2, 3] if x > 1) is clearer and actually shorter than filter(lambda x: x > 1, [1, 2, 3]). I tend to only use map and filter with regular def functions that are already defined.

  • @activestate
    @activestate 4 роки тому

    Great pdb tip!

  • @CODTALES-KILLSTREAKS
    @CODTALES-KILLSTREAKS 5 років тому +2

    Hahahahahah thank you 🙏 you made my whole week Code Drip!

  • @紺野-純子
    @紺野-純子 3 роки тому

    for the pdb you can replace it with breakpoint() instead

  • @solracq100
    @solracq100 5 років тому

    Thanks a lot! Very useful stuff!

  • @samkennedy6725
    @samkennedy6725 4 роки тому +2

    6:40 After that "CS lambda logo" I thought you'd say "lambda is just exactly the same thing you've seen in Counter Strike game" lol

    • @DioD3
      @DioD3 4 роки тому

      Thats not CS logo its Half lifes. CS started as Half life mod before becoming its own game. It was in the logo of Half life because in physics traditionally half life of radioactive decay is marked with lambda the greek letter.

  • @nikluz3807
    @nikluz3807 4 роки тому

    Damn this is my fav new channel

  • @toyomade
    @toyomade Рік тому +1

    Whelp… as I transition from SQL heavy work into data analytics/data science and try to add Python to my skill set, I see exactly how far I have to go lol
    Every journey begins with a single step, off we go!
    Thanks, I’m sure I’ll be back (with context) so that this will make sense

  • @jacksontaylor3220
    @jacksontaylor3220 5 років тому +2

    Great video Aaron! Will you be continuing your data structures series soon?

    • @AaronJack
      @AaronJack  5 років тому

      hey Jackson, I'm continuing the series but don't think UA-cam is the right place for it (algorithm didn't like it). So I'm working on 20 data structures and algorithms videos for a course right now. It will be fully animated and have both JS and Python versions.

    • @jacksontaylor3220
      @jacksontaylor3220 5 років тому

      Code Drip That’s awesome, totally understand. If you’re looking for people to beta test the course I’d love to check it out while you’re working on it

    • @AaronJack
      @AaronJack  5 років тому

      @@jacksontaylor3220 sure, would be great to have some feedback, could you send me an email and I'll send you a link? (codedrip4@gmail.com)

  • @tucan1309
    @tucan1309 4 роки тому +1

    i just wanna say u could have your life way easier if you used pycharm debugger, also u would also have way easier time with venvs and installing packages

  • @emperorscotty
    @emperorscotty 4 роки тому

    i need to start coding now that i went over all the basics

  • @bendirval3612
    @bendirval3612 2 роки тому

    Just use breakpoint() instead of importing pdb using set_trace(). No importing necessary.

  • @avinashtammali6130
    @avinashtammali6130 4 роки тому

    thats quite helpuful mate thanks

  • @MrEcksan
    @MrEcksan 4 роки тому

    Great, thanks!

  • @tee9120
    @tee9120 5 років тому

    Another cool vid, thanks bruh

  • @10OzGlove
    @10OzGlove 4 роки тому +1

    00:19 "Learning on the job is the best way to learn and I do firmly believe that", I'm sure you don't believe in it anymore when you're dealing with someone who's learning on job through the mistakes they're making at your expense...

    • @fullsleevetats
      @fullsleevetats 4 роки тому

      > I'm sure you don't believe in it anymore when you're dealing with someone who's learning on job through the mistakes they're making at your expense...
      That's what code reviews and peer mentoring is for.

  • @ragnarok7976
    @ragnarok7976 10 місяців тому

    The cursive font gave me flashbacks to grade school

  • @robertwallace5498
    @robertwallace5498 4 роки тому

    thank you for these tips :)

  • @hermesmercuriustrismegistu4841
    @hermesmercuriustrismegistu4841 4 роки тому

    Amazing videos!

  • @dominiksabat
    @dominiksabat 4 роки тому +6

    4:39 "we have to do something like this" - not true, you could just call .values()

  • @nmtechie4033
    @nmtechie4033 4 роки тому

    Very useful tools. Thank you so much.

  • @FernandoOrtega10
    @FernandoOrtega10 4 роки тому

    Strings have the startswith() method to check the first letter.
    And you can also do set comprehensions, which use the curly brackets just like the dictionary comprehension.

  • @rogercheng1294
    @rogercheng1294 4 роки тому

    Thanks a lot !

  • @ebentee
    @ebentee 5 років тому

    Thanks for sharing my bro

  • @gsharan2901
    @gsharan2901 4 роки тому

    Your voice makes me fall asleep 😴
    So soothing

  • @NicklasBekkevold
    @NicklasBekkevold 5 років тому +3

    Hey, nice video! Your VScode looks great, which theme / fonts are you using?

  • @mbonuchinedu2420
    @mbonuchinedu2420 5 років тому

    indeed, its gonna be around for a verrrry long time

  • @illmar1037
    @illmar1037 4 роки тому

    here is good tip for you, make the window full screen so the code do not get cut off. also keep your voice consistent, do not mumble.

  • @Endlessvoidsutidos
    @Endlessvoidsutidos 5 років тому

    great vid thanks for the tips

  • @fcmorena246
    @fcmorena246 4 роки тому

    nice tutorial, expects more

  • @jdparden
    @jdparden 4 роки тому

    good job bro!

  • @depressedknight369
    @depressedknight369 4 роки тому

    and thanks a lot for this...it was nice

  • @javiporras3396
    @javiporras3396 5 років тому +4

    quality,
    Would you be able to do small projects for beginners ?
    Thanks!

  • @TechPravinya
    @TechPravinya 4 роки тому

    👍 Good job. Nice presentation and content.

  • @AntonMasyan
    @AntonMasyan 5 років тому

    from python 3.6 or 3.5 you don't have to install virtualenv, because venv now inside the python just type "python -m venv yourproject/venv", next source/bin/active and that's all
    docs.python.org/3/library/venv.html

  • @zephyr7
    @zephyr7 4 роки тому +1

    If u like his font its called dank mono but its not free, if you want a free font similar to it then i suggest Victor Mono

  • @dimitrisfloroskoufis_9866
    @dimitrisfloroskoufis_9866 2 роки тому

    Good evening. I would like to ask how did your journey as a front-end programmer start? What does one need to do not in terms of knowledge. I try to get acquainted with programming but I can not understand it. I feel like I know nothing while I have been studying for hours!

  • @jonathanrodriguez1233
    @jonathanrodriguez1233 4 роки тому +2

    Is that sublime? and if so can you do a tutorial on how to get that terminal and how to make it look like that? Or maybe a link if you have one.
    Thanks!

    • @irend1163
      @irend1163 4 роки тому +1

      It's VSCode, a code editor same like sublime, it's open source and developed by github
      VSCode come with built-in terminal
      CMIIW he use material theme

  • @alfredpolanco4670
    @alfredpolanco4670 4 роки тому

    U da besst, greetings from Dominican Republic!

  • @MrWorshipMe
    @MrWorshipMe 4 роки тому

    No need to install virtualenv, it's already builtin into python 3 (2 is no longer supported), just use python -m venv env to create a virtual environment called env.

  • @thespaceman88p79
    @thespaceman88p79 4 роки тому

    the trick of pdb is already inclueded in the software edu.python (french software made to learn python quite powerfull) and he underline your errror when he detect it s if you new on python this software could be good start to limitate error and understand it better :p

  • @thesam723
    @thesam723 5 років тому

    The lambdas and sort function is good for data science as it's a more functional approach to programming

  • @xgndqeggxgndqegg
    @xgndqeggxgndqegg 4 роки тому

    awesome !