Type Hinting - Advanced Python Tutorial #6

Поділитися
Вставка
  • Опубліковано 15 лют 2021
  • In this video we talk about type hinting in Python.
    ◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
    📚 Programming Books & Merch 📚
    💻 The Algorithm Bible Book: www.neuralnine.com/books/
    🐍 The Python Bible Book: www.neuralnine.com/books/
    👕 Programming Merch: www.neuralnine.com/shop
    💻 Exclusive Content 💻
    👥 Patreon: / neuralnine
    🌐 Social Media & Contact 🌐
    📱 Website: www.neuralnine.com/
    📷 Instagram: / neuralnine
    🐦 Twitter: / neuralnine
    🤵 LinkedIn: / neuralnine
    📁 GitHub: github.com/NeuralNine
    🎵 Outro Music From: www.bensound.com/
  • Наука та технологія

КОМЕНТАРІ • 66

  • @jrgomez
    @jrgomez Рік тому +3

    It's the first time I hear about this feature. I loved it! Definitively I'll start using it in my code. Thanks!

  • @sj_life_and_science
    @sj_life_and_science 10 місяців тому +1

    Any way to automate/run mypy programmatically? Like in a testing tool such as pytest?

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

    I faced a case where I am defining a decorator and cannot use function as a hinted type for the parameter. What do to here?

  • @__3093
    @__3093 3 роки тому +4

    this is actually useful, thanks!

  • @os_.mos_.m9346
    @os_.mos_.m9346 3 роки тому +5

    What is the name of the song you are using in the intro?

  • @sophialawal7306
    @sophialawal7306 Рік тому +3

    Can you make a series on test driven development in python?

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

    Thanks for sharing!

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

    I worked with the list type hinting 🥳

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

    Thank you for your content

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

    Very nice video. I was wondering about exactly these things since a few days. Not sure why less than 1k likes! One added from me.

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

    what kind of ide or editor are you using?

  • @ad007xd2
    @ad007xd2 3 роки тому +6

    Can you make a discord server. People can talk to you and ask questions first handed there and ask the questions can be answered by the community too

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

    what about 2 type hints? like this
    def add(x: float, y: float) -> int or float:
    sum = x + y
    if sum.is_integer():
    return int(sum)
    return sum
    it is okay to use like that?

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

      Yes, you can use union operation

    • @kexec.
      @kexec. 4 місяці тому

      you can use union but in general it's not a good idea since you have to check isinstance every single time...

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

    In versions lower than 3.9 you can use typing for lists:
    from typing import List
    and then
    test_list: List[dict] = []

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

      what about 3.10?

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

      @@Makwayne
      No need to import typing library

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

    at afar, I thought you were a 3d rendered model

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

    Thank you

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

    Thank you for your tutorials!

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

    This is not at all advanced type hinting.

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

    awesome

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

    Can you made a single playlist of Python from beginner to advance.
    As i m bignner so i m confused a little bit about where to go after one playlist.

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

    Will it make the code faster?

    • @brien.
      @brien. 2 місяці тому +1

      No

  • @arthur6999
    @arthur6999 3 роки тому +5

    could you do an async/await tutorial?

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

      I have the same request. Btw, great videos on python. Loving the series.

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

    BTW what's the use of this, if python is intelligent enough to sense the data types automatically. Does declaring types leads to performance boost?

    • @haniffaris8917
      @haniffaris8917 Рік тому +2

      I think it's used as a documentation of sort, to help the programmers understand more what the code does.

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

      helpful for guys using docstring, and thus saves time for some formal documentation. maybe more.

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

    thank u :0

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

    `if type(myparameter) == ...` ?

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

    Can you send your intro music please?

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

      You Had a Good Thing - Herrera Lee Brandon

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

    greetings from germany

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

    Quick question, where do you live (Country/State)

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

      Austria :)

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

      @@NeuralNine I’ve been to Austria, my car broke down there and I had to stay overnight

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

    Mannn... I love this channel. This content is awesome. I'm a developer myself. I just want to know that whether we can do like auto completion in python. Like if you start typing.. something. The most accurate thing shows in light color and when we press enter or tab, it filled automatically.

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

      Auto-completion are mostly handled by the IDE and plugin installed on it. It's also called IntelliSense.

  • @tips1483
    @tips1483 3 роки тому +3

    1st
    Edit: @Aditya beat me.

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

    Man, well done.
    How do you change your typing position without mouse clicking?
    I mean:
    You are typing between codes and defs
    But suddenly you do a shortcut and then
    Booom!
    You're typing in terminal!
    What's that shortcut?
    If you know, please say it in pycharm😅
    Tnx

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

      It's the Vim editor ^^

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

      @@NeuralNine interpreation of " ^^ "???

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

      @@samsabhaya6686 it's a smiley face bruh

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

    Doesn’t work in python2. Not sure from which version of python3 it available. Thank you, for the video.

  • @khatriajaya
    @khatriajaya 11 місяців тому

    Thank you.
    We can also do type checking with Pylance in VScode
    In setting.json
    ```{
    "python.analysis.typeCheckingMode": "basic"
    }```

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

    They can hint all they want. Single and not looking.

  • @zombiekiller7101
    @zombiekiller7101 3 роки тому +3

    Which programming language should I learn after mastering python?
    By the way nice tutorial :)

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

      you should focus on ml or ds that's what python for learning many languages do not make change but mastering 1 do now learn what python work on your pre-existing skill instead of building new one

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

      Ok, thanks

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

      You can't master python

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

      I can master you are noob

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

    meh, such a trivial examples... Do you ever consider of using import typing ?

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

    comment

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

    Okay. A vim advice. If you're using the arrow keys, just don't. Stick with hjkl.

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

      I know and you are totally right. But I am still not really comfortable using 10 fingers. I am practicing ^^

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

    3rd. I am 3rd

  • @davidcmoffatt
    @davidcmoffatt 9 місяців тому

    This is not your best work. You should have gone into more complex things like items that can be None or why you will see type "List" and other times "list". How to do a dictionary or list of lists etc. Since this is a new and changing part of python you should redo this video.

  • @steve_d118
    @steve_d118 5 місяців тому

    It sucks. This guy is just nervous and unstructured.

    • @brien.
      @brien. 2 місяці тому

      okay steve

  • @SergioInToronto
    @SergioInToronto 9 місяців тому

    He's doing his best, but as a Python dev with 5+ years experience, this is cringe.

  • @user-ld8lc4ex4m
    @user-ld8lc4ex4m Рік тому

    Thank you