Enums Explained In Under 12 Minutes In Python

  Рет қаралды 15,269

Indently

Indently

Күн бұрын

In today’s video we’re going to be learning about the basics of enums in Python. We will also be covering what a Flag is and how to use the auto() feature.
▶ Become job-ready with Python:
www.indently.io
▶ Follow me on Instagram:
/ indentlyreels

Пікірлер: 45
@_DT_
@_DT_ 3 күн бұрын
Flag works like: RED = 1 (001) GREEN = 2 (010) BLUE = 4 (100) ALL = 7 (111) because 001 | 010 | 100 = 111
@minepoint6396
@minepoint6396 3 күн бұрын
4 Bit Binary:D (but without the last)
@cmv743a
@cmv743a 3 күн бұрын
FYI 9:04 it auto completed to black instead of blue. Interesting video. Thanks
@Indently
@Indently 3 күн бұрын
I was fighting with autocomplete each time I wrote blue, and it still got me in the end!
@theglobalsouth9680
@theglobalsouth9680 3 күн бұрын
python doing bitflags is nuts as heck. super awesome! i am ready to use it
@theglobalsouth9680
@theglobalsouth9680 3 күн бұрын
i love bitflags
@dragweb7725
@dragweb7725 3 күн бұрын
i knew about Enums, but not about Flags ! Maybe i really should check the whole documentation of the enum package, it seems it haven't revealed all its best secrets yet !
@Indently
@Indently 3 күн бұрын
I swear that when I was reading the docs a couple years ago I never noticed the Flag bit. Goes to show that re-reading the docs isn't always a bad idea!
@efe099
@efe099 3 күн бұрын
I was just planning to dive in to Enums thanks man
@murphygreen8484
@murphygreen8484 3 күн бұрын
Hey Indently! Would you want to do a video refactoring someone's (mine) code?
@boboblacksheep5003
@boboblacksheep5003 3 күн бұрын
Please refactor my code too 😂
@jamesford3282
@jamesford3282 3 күн бұрын
are You guys real?
@murphygreen8484
@murphygreen8484 3 күн бұрын
The code works and is a small program. Was thinking it could be like the code roasts that ArjanCodes does
@aflous
@aflous 2 күн бұрын
​@@murphygreen8484I am an experienced python dev and really like code roasting/refactoring. I've always wanted to start a KZbin channel just to do that. Would you like me to start with yours?
@withjk7
@withjk7 2 сағат бұрын
please do one video on how to dind difference between instance and library vs package vs module
@luffymonkey6967
@luffymonkey6967 Күн бұрын
great coverage of enums, thank you!
@CrateSauce
@CrateSauce 3 сағат бұрын
Hey man, this video is great! I cant stop hearing you talk about Colas tho lol. Color is pronounced CUH-ler in the US and CUH-luh in the UK Thanks for the tutorial!
@michaelhoffmann2891
@michaelhoffmann2891 11 сағат бұрын
I find I use StrEnum with auto() somewhat frequently, though its usefulness some would debate. It's nice to have one clear place to replace a string, rather than having trust my IDE to do a find/replace exactly where I want it.
@Indently
@Indently 10 сағат бұрын
I just learned about IntEnum & StrEnum, will have a video out on that soon :)
@KumR
@KumR 7 сағат бұрын
Thank you for finding us this info...However, Is enum really essential ? I am not able to comprehend why would it be needed ? Just for cleaner looking code ?
@vegameta
@vegameta Күн бұрын
а для чего делать наследование от Enum для строковых значений? для таких случаев имеется StrEnum
@sergiuszkot8116
@sergiuszkot8116 Күн бұрын
I don't understand what have you said but I am agree with you that StrEnum should be used there :)
@vanka_feelgood3000
@vanka_feelgood3000 Күн бұрын
Also IntEnum when you need integers
@_a_x_s_
@_a_x_s_ 2 күн бұрын
You forget the IntEnum which makes it quite useful to be stored as an integer constant directly into the database.
@kadircalloglu2848
@kadircalloglu2848 3 күн бұрын
and also you can use bitwise
@josemanuelfernandez4999
@josemanuelfernandez4999 3 күн бұрын
Awesome!!!!
@user-fp8zc3mx3e
@user-fp8zc3mx3e 3 күн бұрын
Nice
@marionowera5602
@marionowera5602 2 күн бұрын
I think you shouldn't use str as type hint to enum members?
@danielcrompton7818
@danielcrompton7818 3 күн бұрын
I’m so glad python added match case
@GameGame-rp4xc
@GameGame-rp4xc Күн бұрын
I was watching this video and thinking kinda: "is it really python? It doesnt have match statement when i started to learn it and even after 3 years using it - it is a first time i meet usage of match
@akashahmad4779
@akashahmad4779 3 күн бұрын
Greate
@ppgiga
@ppgiga 3 күн бұрын
I literally looked this up yesterday...
@Observer552
@Observer552 3 күн бұрын
Is boolean actually an Enum with 2 constants?
@harcos0608
@harcos0608 2 күн бұрын
No
@DrDeuteron
@DrDeuteron 3 күн бұрын
| is neither union nor addition, it’s bitwise or.
@payton6_
@payton6_ 2 күн бұрын
For those watching: please don’t use f-strings if you aren’t going to use the functionality of f-strings. Readability comes in to play here due to intent
@vicentcaselles4807
@vicentcaselles4807 3 күн бұрын
What's the difference between using flags and sets?
@a-jjjjjjj
@a-jjjjjjj 3 күн бұрын
They are conceptually very similar. Flags define the "universe" of the set, allowing certain operations like complements while also restricting what they can contain. Flags are also immutable and cannot be nested, unlike regular Python sets.
@urknidoj422
@urknidoj422 2 күн бұрын
Using flags allows you to store multiple states in a single integer, which makes it more efficient to save and query in a database, compared to using sets.
@rk_studio585
@rk_studio585 3 күн бұрын
❤❤
@user-mr3mr5oo7n
@user-mr3mr5oo7n 3 күн бұрын
9:02 you mistake blue with black (wrote black twice)
@compositeboson123
@compositeboson123 Күн бұрын
indently ı think my lamb is possesed what do ı do
@Indently
@Indently Күн бұрын
If your lamp is turned on without electricity, you sell it to scientists and become a billionaire
@compositeboson123
@compositeboson123 Күн бұрын
@@Indently oh really ımma do t- *gets assasinated
@rk_studio585
@rk_studio585 3 күн бұрын
❤❤
Avoid These 7 Common OOPSies in Python
24:42
ArjanCodes
Рет қаралды 48 М.
How To Write Better Functions In Python
14:17
Indently
Рет қаралды 20 М.
Поветкин заставил себя уважать!
01:00
МИНУС БАЛЛ
Рет қаралды 4,2 МЛН
escape in roblox in real life
00:13
Kan Andrey
Рет қаралды 72 МЛН
10 Nooby Mistakes Devs Often Make In Python
24:31
Indently
Рет қаралды 62 М.
Learn Python OOP in under 20 Minutes
18:32
Indently
Рет қаралды 31 М.
Is Computer Science still worth it?
20:08
NeetCodeIO
Рет қаралды 123 М.
5 Classic Noob Mistakes In Python
14:39
Indently
Рет қаралды 19 М.
The Midpoint Circle Algorithm Explained Step by Step
13:33
NoBS Code
Рет қаралды 27 М.
10 Important Python Concepts In 20 Minutes
18:49
Indently
Рет қаралды 112 М.
20 Everyday Tips & Tricks in Python
25:18
Indently
Рет қаралды 23 М.
Most Useful Constructs Across Programming Languages
8:33
Kantan Coding
Рет қаралды 22 М.
5 Good Python Habits
17:35
Indently
Рет қаралды 531 М.
Поветкин заставил себя уважать!
01:00
МИНУС БАЛЛ
Рет қаралды 4,2 МЛН