Write Python Code Properly!

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 มิ.ย. 2024
  • Welcome back to another video! In this video, I am going to be showing you the proper way to write Python code. What I mean is that I will be going over the proper python conventions and the most important parts of the python style guide known as PEP8. There is a lot in PEP8 but I'll only go over the most common mistakes made.
    💻 Thanks to HarperDB for sponsoring this video! Spin up a powerful free HarperDB instance here: studio.harperdb.io/sign-up?ut...
    📄 Resources 📄
    Python PEP8 Style Guide: www.python.org/dev/peps/pep-0...
    ⭐️ Timestamps ⭐️
    00:00 | Write Proper Code!
    02:27 | PEP8 Guideline
    03:00 | Installing An Auto Formatter
    05:29 | General PEP8 Guidelines
    07:01 | Naming Conventions
    10:55 | Method Parameter Naming
    12:01 | Function And Class Spacing
    13:33 | Imports
    15:42 | Single Or Double Quotes
    17:16 | Whitespaces
    21:02 | In-Line Comments
    22:12 | is None or == None
    24:05 | Try and Except
    24:46 | String Prefix and Suffix
    ◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
    💰 Courses & Merch 💰
    💻 The Fundamentals of Programming w/ Python: tech-with-tim.teachable.com/p...
    👕 Merchandise: teespring.com/stores/tech-wit...
    🔗 Social Medias 🔗
    📸 Instagram: / tech_with_tim
    📱 Twitter: / techwithtimm
    ⭐ Discord: / discord
    📝 LinkedIn: / tim-ruscica-82631b179
    🌎 Website: techwithtim.net
    📂 GitHub: github.com/techwithtim
    🔊 Podcast: anchor.fm/tech-with-tim
    🎬 My TH-cam Gear 🎬
    🎥 Main Camera (EOS Canon 90D): amzn.to/3cY23y9
    🎥 Secondary Camera (Panasonic Lumix G7): amzn.to/3fl2iEV
    📹 Main Lens (EFS 24mm f/2.8): amzn.to/2Yuol5r
    🕹 Tripod: amzn.to/3hpSprv
    🎤 Main Microphone (Rode NT1): amzn.to/2HrZxXc
    🎤 Secondary Microphone (Synco Wireless Lapel System): amzn.to/3e07Swl
    🎤 Third Microphone (Rode NTG4+): amzn.to/3oi0v8Z
    ☀️ Lights: amzn.to/2ApeiXr
    ⌨ Keyboard (Daskeyboard 4Q): amzn.to/2YpN5vm
    🖱 Mouse (Logitech MX Master): amzn.to/2HsmRDN
    📸 Webcam (Logitech 1080p Pro): amzn.to/2B2IXcQ
    📢 Speaker (Beats Pill): amzn.to/2XYc5ef
    🎧 Headphones (Bose Quiet Comfort 35): amzn.to/2MWbl3e
    🌞 Lamp (BenQ E-reading Lamp): amzn.to/3e0UCr8
    🌞 Secondary Lamp (BenQ Screenbar Plus): amzn.to/30Dtafi
    💻 Monitor (BenQ EX2780Q): amzn.to/2HsmUPZ
    💻 Monitor (LG Ultrawide 34WN750): amzn.to/3dSD7tS
    🎙 Mic Boom Arm (Rode PSA 1): amzn.to/30EZw9m
    🎚 Audio Interface (Focusrite Scarlet 4i4): amzn.to/2TjXsih
    💸 Donations 💸
    💵 One-Time Donations: www.paypal.com/donate?hosted_...
    💰 Patreon: / techwithtim
    ◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
    ⭐️ Tags ⭐️
    -Tech With Tim
    - Python
    - Code
    - Write Code Properly
    - Pep8
    - HarperD8
    ⭐️ Hashtags ⭐️
    #TechWithTim #Python

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

  • @haibai1766
    @haibai1766 2 ปีที่แล้ว +57

    Cases:
    snake_case
    lowerCamelCase
    UpperCamelCase / PascalCase
    SCREAMING_SNAKE_CASE

    • @GCKteamKrispy
      @GCKteamKrispy 4 หลายเดือนก่อน +1

      Cases:
      python_case
      CppCase

  • @bassam.2023
    @bassam.2023 11 หลายเดือนก่อน +13

    For such a versatile, and useful language, many of Python's conventions are absolutely assinine.

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

      😱😱😱 how dare you ! (Joking)

  • @ex0stasis72
    @ex0stasis72 2 ปีที่แล้ว +16

    I love the way that snake case looks in PEP-8. At first I was not excited about having to reach my fingers to do the awkward _ characters, but really, I only need to type those when I first declare the variable. Every other time I use that variable, I can just use my editor's autocomplete and just skip all the underscore characters and then just hit tab to accept the autocomplete.

  • @huantian
    @huantian 2 ปีที่แล้ว +16

    Random things: order of imports is recommended to be future imports, builtin packages, 3rd party modules, project specific imports, each separated with a newline.
    When you have a keyword argument with a typehint, you add the extra spaces: def foo(str: arugment = “hi”):

  • @ankitaburman5406
    @ankitaburman5406 2 ปีที่แล้ว +2

    You are right now my most favourite person on this planet...❤️ Thanks a ton for all the learning videos

  • @tadiwashangwa4931
    @tadiwashangwa4931 2 ปีที่แล้ว +8

    I was actually researching on this thank you Tim

  • @Cpt_Diabetes
    @Cpt_Diabetes 7 หลายเดือนก่อน

    Hi Tim, i'm very new to tech and a career changer, i just want to say that the content here is one of the best explanations i've found scouring the interwebs!

  • @tahirahmed96
    @tahirahmed96 2 ปีที่แล้ว +8

    Tim I'm beginner at python and overall new to programming your videos are helping me a lot. I'm really interested in data analysis can you please make some videos on this topic

  • @zulucharlie5244
    @zulucharlie5244 5 หลายเดือนก่อน

    Excellent, to-the-point summary of PEP8 convention. Thank you.

  • @ncmathsadist
    @ncmathsadist ปีที่แล้ว +7

    If you use if foo[3:] == "bar" and you subsequently change "bar" to "barf", your code is broken unless you also edit the slice size. This is brittle. That's why Guido recommends endswith and startswith.

  • @zachfenton608
    @zachfenton608 2 ปีที่แล้ว +1

    this is awesome and explained well why these rules are used

  • @akira_asahi
    @akira_asahi ปีที่แล้ว +1

    Thank you for the video. I am grateful for your time and contribution. Kind regards, Akira.

  • @Markyroson
    @Markyroson 2 ปีที่แล้ว +87

    Camel case: aka how you spot people who started in other programming languages and have a hard time breaking the habit in Python 😂

    • @sucman1684
      @sucman1684 2 ปีที่แล้ว +12

      actually, i started in python and started with camelcase because that’s how i used to write my usernames in games.

    • @user-uf1js6uq2f
      @user-uf1js6uq2f 2 ปีที่แล้ว

      Glyyy
      Yvvbg G
      Yep

    • @Jay_0605
      @Jay_0605 ปีที่แล้ว +2

      Me because I started with java and javascript

    • @FADHsquared
      @FADHsquared ปีที่แล้ว

      This is why you need a linter

    • @luigidabro
      @luigidabro ปีที่แล้ว +6

      Camel case:
      How to future-proof your code, when you learn another programming language

  • @Landon_Hughes
    @Landon_Hughes 2 ปีที่แล้ว +6

    I swear every time I look something up, you release a new video on the subject lol
    Thanks!

  • @BartWillems1969
    @BartWillems1969 2 ปีที่แล้ว +48

    Irony: in an article title "write proper python code" using "from os import path" as an example when Pathlib is by far the preferred solution for handling file paths

    • @yourdadsbestfriend7101
      @yourdadsbestfriend7101 2 ปีที่แล้ว +3

      glad im not the only one who thought about that

    • @evanhagen7084
      @evanhagen7084 2 ปีที่แล้ว +3

      Is pathlib built in?

    • @pierre-manchon
      @pierre-manchon 2 ปีที่แล้ว +2

      @@evanhagen7084 yes

    • @BartWillems1969
      @BartWillems1969 2 ปีที่แล้ว +1

      @@evanhagen7084 it’s in the standard library, just like `os` - no pip install required.

    • @nguyenanhquan4431
      @nguyenanhquan4431 2 ปีที่แล้ว +8

      You missed the point. He was just giving an example that if you import multiple things from the same module then you should put them on the same line according to PEP8.

  • @therzook
    @therzook 2 ปีที่แล้ว

    Yep, defo show it in work tomorrow... our team's coding is like NY subway wall, snake here, camel there, pascal on top and indentation may vary a lot.... Not to mention those long strings punching through the sides of 2 screens...

  • @roydadancegod
    @roydadancegod 2 ปีที่แล้ว +5

    Also could you cover what to do for parameter and return type and the spacing for it? For example def function(a:int, b:list) -> list

  • @emaddeve20
    @emaddeve20 2 ปีที่แล้ว

    Wow this is vedio is so useful. Thank You Tim

  • @sumitpatidar3143
    @sumitpatidar3143 2 ปีที่แล้ว +4

    Unconsciously I follow all pep8 style guide you have discussed in this video 😄

    • @danub5551
      @danub5551 2 ปีที่แล้ว

      same lmao i thought i was the only one

    • @satyampatel3713
      @satyampatel3713 2 ปีที่แล้ว +4

      ah yes pycharm does annoy with those squiggly lines

  • @rachinter
    @rachinter ปีที่แล้ว

    This video should have millions of views 💯❤️🔥

  • @SajidAli-wy1zs
    @SajidAli-wy1zs 2 ปีที่แล้ว +4

    your channel is best. From bangladesh.

  • @terrisquire1940
    @terrisquire1940 2 ปีที่แล้ว

    Thanks for this!

  • @captain_trips994
    @captain_trips994 2 ปีที่แล้ว

    awesome video. thank you

  • @TheFootballPlaya
    @TheFootballPlaya 2 ปีที่แล้ว

    i didn't know about the startswith thing either, good to know. i've seen it around used a lot. question though, for function names that are multiple words, do these act similarly to variable names as in they are snake case as well, or is there some other way of denoting functions as opposed to variables? also, do we treat lambda functions any differently in this regard if they are stored in a variable?

  • @AI-tg2by
    @AI-tg2by 2 ปีที่แล้ว +3

    Love your vids! Could you do any about when you would use classes because I do get confused slightly.. maybe through doing a project - that would be ace!

    • @Dante-nu5cn
      @Dante-nu5cn 2 ปีที่แล้ว +1

      Yes please! Great idea, I was just thinking about that!

  • @melissaleigh3013
    @melissaleigh3013 2 ปีที่แล้ว

    Amazing and Tim you are glowing

  • @ZombiProcess
    @ZombiProcess 2 ปีที่แล้ว

    Great video thanks

  • @sergiomendoza6833
    @sergiomendoza6833 2 ปีที่แล้ว

    Great vid! Tim!

  • @mohbkhaled6051
    @mohbkhaled6051 11 หลายเดือนก่อน

    The autoformat feature on save is just a life saver my code instantly looked X10 better by just saving the file

  • @Lunolux
    @Lunolux 2 ปีที่แล้ว +1

    nice
    i try to use more often convention name when i'm programming now, not very easy

  • @peschebichsu
    @peschebichsu 2 ปีที่แล้ว +12

    Amazing video, was wishing for a while you talk about it! One thing about the comments (ca. 21:55): Is there a convention, when the comment should be on the same line as the code and when it should be on a new line above it?

    • @paulzupan3732
      @paulzupan3732 2 ปีที่แล้ว +3

      There's no real convention for it, you basically just have to use your own discretion. One way that I decide which one to do is that if I'm trying to write a comment about a block of code, I put the comment above the block of code, but if there's something I want to say about a specific line of code, then I just put it on the same line.

  • @save-scum
    @save-scum 2 ปีที่แล้ว +2

    What screen recording + editing software do you use? Your code is presented very aesthetically and in an easy to read/comprehend way!

    • @delufr
      @delufr 2 ปีที่แล้ว +4

      To record the screen he uses OBS (as basically 99% of content creators), the webcam can be also implemented directly in obs, without using an editing software, anyway if you are looking for a free editing software the best is Davinci Resolve!

  • @DefWorlds
    @DefWorlds 2 ปีที่แล้ว +6

    It would be great to see some best practices re how best to break long lines and line up chains of method calls.

  • @ahmadanis9930
    @ahmadanis9930 2 ปีที่แล้ว +1

    Add
    ```
    "python.linting.flake8Enabled": true,
    "python.linting.enabled": true,
    "editor.rulers": [70, 79]
    ```
    to settings.json in .vscode for seeing a line for 80 characters and warnings for not following pip8

  • @Queso791
    @Queso791 2 ปีที่แล้ว +3

    Thank god, a list of my fav youtuber 😎👌, keep up Tim.

  • @typeterson8376
    @typeterson8376 2 ปีที่แล้ว

    Unexpected banger. As the expression (roughly) goes: "any fool can write code that a computer can understand, the challenge is to write code that a human can understand"

  • @Schnieker
    @Schnieker 2 ปีที่แล้ว +1

    What about numbers? Can i name my variable test_1 or should i name it test_one?

  • @dimitriosdesmos4699
    @dimitriosdesmos4699 2 ปีที่แล้ว

    thanks very nice

  • @umeshlab987
    @umeshlab987 2 ปีที่แล้ว +1

    This is useful for timathon

  • @inselmanu
    @inselmanu 2 ปีที่แล้ว

    Danke Tim und Grüße aus Deutschland

  • @tablenkov4993
    @tablenkov4993 2 ปีที่แล้ว

    Thanks.

  • @codingcrashkurse6429
    @codingcrashkurse6429 2 ปีที่แล้ว +16

    Won´t get as many views as normally, but this is such an important topic!. I always get crazy when I see people coding x == None or even worse:
    try:
    x()
    except:
    pass

    • @Chemasaurus
      @Chemasaurus 2 ปีที่แล้ว +1

      Wait, what's wrong with
      if x == None:

    • @mmbaguette1520
      @mmbaguette1520 2 ปีที่แล้ว +1

      @@Chemasaurus It's faster to do *if (type(x) is int)* for example.

    • @Chemasaurus
      @Chemasaurus 2 ปีที่แล้ว +2

      @@mmbaguette1520 But is there anything wrong with if x == None? Is it any different than if x is None?

    • @Joe-zg9eq
      @Joe-zg9eq 2 ปีที่แล้ว +2

      whats wrong with
      try:
      [CODE]
      except:
      pass
      I use that a lot

    • @inakiarias7465
      @inakiarias7465 2 ปีที่แล้ว +2

      @@Joe-zg9eq If you are trying something and it fails, you should handle the errors, ideally. At least you would log or state what's the error that happened. But passing after failing in a try block is considered very bad because of that.

  • @bartugonulalan
    @bartugonulalan 2 ปีที่แล้ว +4

    when he says "is not not not is "
    my 5 years old brain: **giggles**

    • @FADHsquared
      @FADHsquared 2 ปีที่แล้ว

      It is what it is

  • @muhammadanique2256
    @muhammadanique2256 2 ปีที่แล้ว +1

    Hey Tim ! Please do a react and Django project , please 🥺

  • @alagappank1242
    @alagappank1242 2 ปีที่แล้ว +1

    Tim , some Tutorial for Data Science please....

  • @georgeseese
    @georgeseese ปีที่แล้ว

    Thanks for your expertise. At 22:35 it appears that you're saying if x = False or if x = 0, "if x:" will trigger. Isn't it the opposite? The shorthand "if x:" refers to True or something > 0, depending on the object reference.

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

      that's right, it should be if not x:

  • @therabidpancake1
    @therabidpancake1 9 หลายเดือนก่อน

    Just some random information I find that when I use double quotes that it allows me to use words like in or is . For example print("spike is a good dog ") . Indentation in python doesn't make a lot of sense to me . I know everything after the colon is indented but what I am talking about is why . I tried to have a buddy of mine explain it to me but it is still clear as mud . He says that it executes each line of code in order of the indentation . While that may be true it does not make a tone of sense . So what does the computer recognize def blank():
    it would throw an error if I didn't write pass .

  • @user-gv9uw7cx6x
    @user-gv9uw7cx6x 5 หลายเดือนก่อน

    cool video)

  • @Richard_GIS
    @Richard_GIS ปีที่แล้ว +1

    I do programming in python on a daily basis and i really do not follow most of the pep Guidelines as python itself is not really following their own standards too. The best tip you also mention is, consistency. I do camelcase for normal var, for class and function i follow the pep with the underscore.

    • @pietheijn-vo1gt
      @pietheijn-vo1gt ปีที่แล้ว

      What do you mean python is not following their own standards? Maybe you can deviate from PEP if you work on projects by yourself, but if you work in a team you really all have to follow the same styleguide otherwise the codebase becomes a mess. So why not follow PEP. Most IDE's can automatically check for it as well.

    • @Richard_GIS
      @Richard_GIS ปีที่แล้ว

      @@pietheijn-vo1gt no you missed the point, I do follow the pep, as in some cases it could cause follow up issues if you do not. But considering Naming vars and defs it is not that important but consistency through out the script. When you write camel case var instead of underscore, no Big deal. In bigger projects you do follow the standard AND what the team deside, if there is a preference to write vars like this and that. I am really only referring to naming, nothing more ore less. If a programmer cannot read that, he /she is maybe not a programmer. The key word is consistency. Regarding there own standards, when you read the peps its sometimes a mess what is proposed and what not, what is adopted what not, sometimes it changes..i found it quit hard to read. I read one pep where python itself was not consitent - but sorry i cant remember what was it exactly.

    • @pietheijn-vo1gt
      @pietheijn-vo1gt ปีที่แล้ว

      @@Richard_GIS I missed the point? You literally said "i really do not follow most of the pep Guidelines". Maybe you missed the point? I think every team should follow PEP and only deviate if there is a very good reason to do so, everybody agrees and the code linters validate the deviation too. I have contributed to a few open source projects and they tend to use linters that simply reject your commits if it doesn't pass PEP. I haven't found anything inconsistent in PEP so I wouldnt know what you are talking about. But on the other hand PEP is very comprehensive and humans can make mistakes so it wouldn't be weird if there were a few inconsistencies. If you spot them, just report it.

  • @Noone-lw6ge
    @Noone-lw6ge 2 ปีที่แล้ว

    You should be using spaces for indentation. Me who just uses the default auto-indent from sublime

  • @ismahelo
    @ismahelo 2 ปีที่แล้ว +1

    What theme and font do you use for VS Code? By the way, very useful tutorial!

    • @aduomas5972
      @aduomas5972 2 ปีที่แล้ว +1

      Following.

    • @luul4683
      @luul4683 2 ปีที่แล้ว

      .

    • @kekkaigenkei
      @kekkaigenkei 2 ปีที่แล้ว

      Theme: Monokai
      Font: I think it's the default Consolas
      The theme enables the font italicizing on function / class declaration

  • @ThEBengaliFriEnDz
    @ThEBengaliFriEnDz 2 ปีที่แล้ว

    can anyone tell me wich theme tim uses in vs code?

  • @SavorkoTime
    @SavorkoTime 2 ปีที่แล้ว

    Thank you, after this video almost all bugs on my project were closed! And they fire me, coz they dont need python dev anymore...

  • @omerfi
    @omerfi 2 ปีที่แล้ว

    I think you should make a playlist about clean code and add this video to the playlist

  • @Raja-tt4ll
    @Raja-tt4ll ปีที่แล้ว

    Nice

  • @omar72999
    @omar72999 2 ปีที่แล้ว

    Hey man, this is random but what chair is that? I have the exact same desk as yours (the table top and Alex from IKEA) and have been struggling to find a chair that fits them for a while now. Is your chair comfortable? if so do you mind giving me a link so I can get a similar one?

    • @TechWithTim
      @TechWithTim  2 ปีที่แล้ว +1

      It’s a great chair, absolutely love it. It’s called a Herman Miller Aeron chair, I have the classic version but they now have an updated one with ever more features. I also have a head rest which I bought separately

    • @omar72999
      @omar72999 2 ปีที่แล้ว

      @@TechWithTim alright thanks a lot man!

    • @Nordlys0
      @Nordlys0 ปีที่แล้ว

      The new updated chair's head rest can be moved by a 4spaces/tab distance each time to fit the correct indentation of the head rest angle..
      hehhe

  • @eyal4
    @eyal4 2 ปีที่แล้ว

    pleas more open cv :)

  • @kristjanbradac8931
    @kristjanbradac8931 2 ปีที่แล้ว

    Can someone tell me what colorsheme is this, pls? It's like in sublime text3. :D

  • @richardcasey4439
    @richardcasey4439 5 หลายเดือนก่อน

    This is so important for readability

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

    what about if __name__ == "__main__": using double equal signs ?

  • @AfshinDavoudy
    @AfshinDavoudy ปีที่แล้ว

    Black formatter changes "x = x*2 + 1" to "x = x * 2 + 1". So, it is not based on PEP8. am I right?

  • @adithmanu3715
    @adithmanu3715 2 ปีที่แล้ว

    You can use Ctrl + J to hide the terminal

  • @andregarvin5529
    @andregarvin5529 11 หลายเดือนก่อน +1

    If x is false then the if statement will not trigger. only if the value is True or True equivalent

  • @virgile8957
    @virgile8957 2 ปีที่แล้ว

    the name for the all-caps snake case is screaming snake case.

  • @nickvledder
    @nickvledder 2 ปีที่แล้ว +1

    How about: pip install pycodestyle?

  • @Louis16261
    @Louis16261 11 หลายเดือนก่อน +1

    The PEP8 maximum line length is 79 chars, not 80.

  • @santoshkumargouda6033
    @santoshkumargouda6033 2 ปีที่แล้ว

    From where i get the code?

  • @luul4683
    @luul4683 2 ปีที่แล้ว

    which font is it?

  • @soulninjadev
    @soulninjadev 2 ปีที่แล้ว +1

    @Hethat take notes :mhm:

  • @Klannahar
    @Klannahar 2 ปีที่แล้ว

    What about class variables? Same as normal variables?
    Is this style used in any language?
    "myVariableName"

    • @sherluck_code
      @sherluck_code 2 ปีที่แล้ว

      The class variables should still be the same as the normal variables, in this case snake case, but if you mean the class name the class name should be a pascal case like class ClassName

    • @Klannahar
      @Klannahar 2 ปีที่แล้ว

      @@sherluck_code I ment like self.my_variable, and the question part is just in general. Idk i remember somewhere i saw that type, but not sure it was just a user preference or it was specific to other programing language.

  • @orangecoat3848
    @orangecoat3848 ปีที่แล้ว

    Interviewer: "Why were you fired from your previous job?"
    Me: "Something i did at work"
    Interviewer: "Which was ?"
    Me: "Indent camel case with tabs in python in lines with more than 80 lines"
    Interviewer: "Next please"

  • @adrielbradley6677
    @adrielbradley6677 2 ปีที่แล้ว +5

    I always use single quotes for single words 'hello' and then double quotes for longer strings.

  • @baptistearnould2313
    @baptistearnould2313 2 ปีที่แล้ว

    What text color is he using on VCStudio ?

  • @podemb.
    @podemb. ปีที่แล้ว +1

    code is code

  • @sgt391
    @sgt391 2 ปีที่แล้ว +2

    When I break code conventions I know I'm writing shitty buggy code that I'm going to rewrite in the future

  • @harrypotter6894
    @harrypotter6894 2 ปีที่แล้ว

    mans holding onto that hair for dear life. time for a shave bro!!

  • @ayushganguli1359
    @ayushganguli1359 2 ปีที่แล้ว

    I am still a noob but in my limited experience its best not to use black in case of a collaborative project with git. Goodluck merging commits on using black. Auto format makes your life hell on merge

  • @bijeshmohan
    @bijeshmohan 2 ปีที่แล้ว +1

    How should I order my imports?

    • @fastrockstar1705
      @fastrockstar1705 2 ปีที่แล้ว +2

      Imports should be grouped in the following order:
      1. Standard library imports.
      2. Related third party imports.
      3. Local application/library specific imports.

    • @bijeshmohan
      @bijeshmohan 2 ปีที่แล้ว +1

      @@fastrockstar1705 should I order each section alphabetically?

    • @fastrockstar1705
      @fastrockstar1705 2 ปีที่แล้ว

      @@bijeshmohan That's up to your liking.

  • @guitaek4100
    @guitaek4100 2 ปีที่แล้ว

    Actually watched the video twice. Especially the spacing was very helpful 👍 however, as far as I know, classes without a parent are going to be the old-style-classes

    •  2 ปีที่แล้ว

      No, in Python 3 there are not any old-style classes.

  • @Kay-qg1vn
    @Kay-qg1vn ปีที่แล้ว

    That's why i use pycharm 😌

  • @ethiogazeta
    @ethiogazeta 2 ปีที่แล้ว

    Ya

  • @developertools95
    @developertools95 2 ปีที่แล้ว

    make some project on python

  • @wongkingshun
    @wongkingshun ปีที่แล้ว +2

    I think it is much more easier for viewers to follow a 25 to 30 mins videos long video rather than a 6 videos long video.
    And subdivide them into different small topics

  • @huey1153
    @huey1153 2 ปีที่แล้ว

    I thought you were going to go into code quality software engineering principles such as DRY, SOLID, KISS and principles like that 😅

  • @demerion
    @demerion 2 ปีที่แล้ว

    Can we name a variable "var1"? Or would snake_case be "var_1" in this case? What is the convention when using numbers?

    • @chilly111
      @chilly111 2 ปีที่แล้ว

      I would use more descriptive names and if I needed variables of the same name indexed I would prob store them as a list instead:
      vars = ['x', 'y', 'z']
      and access them like
      print(vars[2])

  • @RoyalTutorial
    @RoyalTutorial 2 ปีที่แล้ว

    Anyone here uses Pydev with Eclipse?
    Should I make the move to Visual Studio?

    • @tooru
      @tooru 2 ปีที่แล้ว +1

      bruh

  • @codingboy2254
    @codingboy2254 2 ปีที่แล้ว +1

    Is this guy reading minds, I was literally watching a seminar by uncle Bob on writing clean code , and he posts this video .
    CREEPY!!!!!!!!!!!!!!!!!!!!!!!!

  • @ivernik
    @ivernik 2 ปีที่แล้ว

    Thank god for pycharm. 😅

  • @albertojlorenzorosario2759
    @albertojlorenzorosario2759 2 ปีที่แล้ว +1

    camelCaseIsKing change my mind

  • @JorgeLuis-ts6qp
    @JorgeLuis-ts6qp 2 ปีที่แล้ว +1

    One of the things I hate the most from Python y how much you must trust the developers. It's incredible there is no way of making a variable constantant!!

    • @ed-xs3pu
      @ed-xs3pu 2 ปีที่แล้ว +1

      I'm new to python and coding. Is there value to having it defined as a constant vs. just capitalizing it. If it's capitalized then you should know not to change its value right? Or is there something else to it?

  • @donwald3436
    @donwald3436 4 หลายเดือนก่อน

    lol 80 columns, 19976 called they want their teletype terminals back.

  • @herojedrus2567
    @herojedrus2567 2 ปีที่แล้ว

    you did not tell what to do when `from module import thing1, thing2, thing3, thing4, ...` is too long :(

  • @jyothiramesh9856
    @jyothiramesh9856 2 ปีที่แล้ว

    2nd viewer

  • @0x007A
    @0x007A 2 ปีที่แล้ว +12

    The most annoying Python code, regardless of its potential usefulness, is poorly (or completely abscent) commented source code.

    • @user-zn8lt8tj5g
      @user-zn8lt8tj5g 2 ปีที่แล้ว +1

      Self-explanatory code does not require comments

    • @ed-xs3pu
      @ed-xs3pu 2 ปีที่แล้ว +2

      @@user-zn8lt8tj5g required... No. But comments on WHY the code is there is quite useful. And comments are much easier for your brain to parse.

    • @sscapture
      @sscapture 7 หลายเดือนก่อน

      @@user-zn8lt8tj5g It does

  • @christianemden7637
    @christianemden7637 2 ปีที่แล้ว

    The rules on the use of white spaces seems to be rather inconsistent.

  • @stivunnikolov5941
    @stivunnikolov5941 2 ปีที่แล้ว +3

    Is someone really pressing 4 spaces instead of tab?

    • @lemmyboy4107
      @lemmyboy4107 2 ปีที่แล้ว

      Just make a makro that 1 tab = 4 spaces xd.

    • @stivunnikolov5941
      @stivunnikolov5941 2 ปีที่แล้ว

      @@lemmyboy4107 you are very smart boy.... I hope smart enough to feel the irony...

    • @lemmyboy4107
      @lemmyboy4107 2 ปีที่แล้ว

      @@stivunnikolov5941 i mean i can send that back. Most ides would brake without a dedicated tab.

  • @diamonddemon7612
    @diamonddemon7612 2 ปีที่แล้ว

    i use single quotes for 1 character and double quotes for mor than that

  • @meloman7094
    @meloman7094 5 หลายเดือนก่อน

    Thank you very much for the Russian subtitles!)

  • @eylonemuskson4177
    @eylonemuskson4177 2 ปีที่แล้ว

    _Once you go Black, do you don't...ever, have to worry about messy Python code again...._
    I'm a poet.

  • @bratpeki
    @bratpeki 2 ปีที่แล้ว

    so you just showed off syntax preferences instead of actually common coding mistakes and hos to correct them?