6 CLEAN Tips To IMPROVE Your Python Functions

6 CLEAN Tips To IMPROVE Your Python Functions

Indently

1 год назад

72,602 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@fredflintstone8048
@fredflintstone8048 - 16.10.2023 02:41

Excellent advice. Thank you for sharing.

Ответить
@behnamheydarian9569
@behnamheydarian9569 - 06.09.2023 02:02

I just watched this video, and after tip num 6, i have questions.
If we import modules outside of the function and using it in our function, then when we use the function in another file, do we get an error because we didn't import a module, or it will import automatically?

Ответить
@arthurarashbricenoheidari2858
@arthurarashbricenoheidari2858 - 26.07.2023 18:04

i loved your videos thanks a lot man

Ответить
@muntadher8087
@muntadher8087 - 08.04.2023 23:04

Useful information thanks

Ответить
@gedtoon6451
@gedtoon6451 - 08.04.2023 15:59

At 3 mins into the video you pass a number of integer parameters to a function that has a type hint of float. You did not explain that parameters with a type of float will happily accept integers as well.

Ответить
@atulkumaryadav790
@atulkumaryadav790 - 28.03.2023 13:35

return type is not working for me, still I can retrun other data type without any issue

Ответить
@master_sergik
@master_sergik - 26.01.2023 17:02

Very useful tips, thanks 👍

Ответить
@PanduPoluan
@PanduPoluan - 16.01.2023 14:42

I see you using PyCharm. Man of class 👍🏼

Ответить
@jonathanlloyd8688
@jonathanlloyd8688 - 11.01.2023 09:35

Hi, I am using vs code and when I type hint my return type some of my keywords turn white. I am using vs code. Can anyone help me out here?

Ответить
@ShivaniSingh-ce6vb
@ShivaniSingh-ce6vb - 24.12.2022 11:02

Man, you are awesome I loved this video I would like to watch more of these.

Ответить
@kcvinu
@kcvinu - 24.12.2022 00:51

Few days ago, I needed to use a numpy function. One of the two parameters of that function is shape. I have no idea about the type of that parameter. So I refered to numpy docs. Sadly, there was no clue about that. But I got a link to source of code of that function. I felt very happy, because, I thought I can now read and understand what the shape is. But sadly, it was a parameter with default value None. And the docstring says nothing about the type or nature of that parameter. So at last, I decided to not use numpy and re arranged my code.

Ответить
@RobinZuFALL
@RobinZuFALL - 23.12.2022 04:29

Where can i get that white python hoodie?

Ответить
@JordanMetroidManiac
@JordanMetroidManiac - 21.12.2022 09:51

I think avoiding the global keyword is the best tip because it usually means you need to define an object which handles internal or persistent data automatically. I really cannot think of an instance where you must use the global keyword.

Ответить
@whkoh7619
@whkoh7619 - 19.12.2022 10:11

Great intermediate level tips! Thanks

Ответить
@judithlee7989
@judithlee7989 - 18.12.2022 11:20

Can you do a tutorial on how to properly write function/module documentations? Thanks!!!

Ответить
@MechMK1
@MechMK1 - 17.12.2022 02:45

I love how in the pre-type-hint-era, many Python devs were very smug about how amazing it is to not have to specify your types. Type Hints get added, and now they're all figuring out that being somewhat strict about what types you pass around actually makes sense.

It's almost as if being strict while writing makes things much easier when reading.

Ответить
@Spiderfffun
@Spiderfffun - 16.12.2022 23:40

Sometimes I need the global functions, idk why they are so bad







spaghetti code

Ответить
@fluffykitties9020
@fluffykitties9020 - 16.12.2022 02:27

hi. for function return notation (point 1) why not just look at the return statement or add a comment to have notation of return type? are there any other advantages to this style of notation that make up for (visually) turning code into garbally gouk?

Ответить
@castlecodersltd
@castlecodersltd - 14.12.2022 17:33

Some great tips, thanks ☺. Is there a pythonic reason for all lower case function names with an under in between words? I personally don't like the underscore in function names and prefer PascalCase (uppercased first letter of each word in the function name) for names, they stand out more.

Ответить
@ashersaipe
@ashersaipe - 14.12.2022 17:06

I've been binging your videos lol they're so great. If you haven't already, I'd love to see you make a video about generators and the "yield" keyword. I really don't understand it but I'm sure you could explain it well :)

Ответить
@WhyNotProgram
@WhyNotProgram - 14.12.2022 17:05

Good stuff! I still make that #4 mistake quite often in my python apps and pay for it later with code refactors haha

Ответить
@SP-db6sh
@SP-db6sh - 14.12.2022 15:42

Use match statements with walrus... Deadly combo for beautification of this code

Ответить
@kelvenlim9283
@kelvenlim9283 - 14.12.2022 14:51

For tip 4, is it something like making the functions as atomic as possible? (I borrow the term "atomic" from databases which means the smallest components)

Ответить
@davidl3383
@davidl3383 - 14.12.2022 12:49

thank you so much. Your chanel helps me a lot to improve my learning of python. Good practices, tips etc. So this morning, I changed my code to add these good practices ;) Very nice these little videos on specifics points. Congrats

Ответить
@jakedeschamps4454
@jakedeschamps4454 - 14.12.2022 12:48

Wow, I didn't even know I could specify return type and parameter type in python! I used to think that my python code looked super messy and potentially unpredictable compared to other languages. I'll definitely be making use of this!

Ответить
@mzakyr42
@mzakyr42 - 14.12.2022 09:29

Hey second or third probably

Ответить
@yapnog603
@yapnog603 - 14.12.2022 09:13

How do you do that arrow head after the def func?

Ответить