This forbidden Python syntax will get you fired. #code #programming #python
Пікірлер: 277
@samuelepesce10 ай бұрын
The shame operator
@Indently10 ай бұрын
I love it
@nandyalanaresh116110 ай бұрын
@@Indentlymiric operators
@florunio10 ай бұрын
Great name 😂
@nandyalanaresh116110 ай бұрын
@@florunio which one bro shame operator or miric operators
@maciejzettt10 ай бұрын
Yeah, there is already list comprehension, let there be list shaming 😂
@dk-ww3kp10 ай бұрын
It should be called illegal.😂
@StudioHawaii10 ай бұрын
Now I can say "Use an illegal for this"
@samueljehanno9 ай бұрын
😂
@dfields95119 ай бұрын
Yep The ugly thing code I had to write was in c++ *(static_cast(objPtr))->data = Variable ObjPtr was a class was defined like this Class my class : public baseclass , public: datastruct { } And datastruct was defined like this Struct datastruct { Type fields }
@crysian870310 ай бұрын
The comma is because you have to build a tuple to assign each element on the right. The idea is to unpack the elements in _ somewhere. It's like writing a single-element tuple, it needs a comma. A good example of this is ((1, )) == (1, ) or using the match-case
@powerball2009 ай бұрын
what is this assignment called? and what was this a,*b,c assignemnet called?
@kipchickensout9 ай бұрын
@@powerball200I think extended unpacking
@G2Rich_9 ай бұрын
I see so the resulting tuples are mutable which is why the output is Each letter in brackets correct?
@xxlarrytfvwxx95319 ай бұрын
@@G2Rich_The square brackets inform us that it's a _list_.
@krishnakoushiktelanakula99239 ай бұрын
@@powerball200It's just called tuple assignment.
@RainingArtillery9 ай бұрын
My favorite part about python is when Isildur fails to cast it into the fire
@knghtbrd2 ай бұрын
That's not how the force works, Gandalf.
@paierarwe10 ай бұрын
it should be called Obelisk, as it goes alongside Asterisk
@jabthejewboy10 ай бұрын
That is so incredibly cursed.
@TheTriggor10 ай бұрын
Reading from _ feels extremely cursed
@MattPlncht9 ай бұрын
You can have anything instead of _ I don't know why he used the underscore instead of a proper variable name
@HoloTheDrunk9 ай бұрын
@@altimmons I've always interpreted it and seen it interpreted as the "ignored" name for a variable (that meaning's actually the official one in Rust as all variables starting with _ are excluded from unused checks done by the compiler)
@no-name1688 ай бұрын
I've seen pros used underscore for looping when you don't need an actual name, just loop. That's clean af.
@modernkennnern8 ай бұрын
_ should only be used for discards - for when the value is never used.
@christianhowell314010 ай бұрын
Id call it the "explosion assignment operator"
@mwaringmlw10 ай бұрын
It would get you fired because you're using an underscore as a variable name, not for using unpacking. Making something look mysterious and inscrutable is cool for puzzles, I just hope it's not your main method of teaching...
@TheNzdavis10 ай бұрын
I am new to python and I was really confused why its forbidden until your comment. Thanks.
@user-xo3lh4lo1s2 ай бұрын
Yeah..
@georgileikin2 ай бұрын
So no asking "What are you doing?", no advising "Don't do that, it makes the code hard to understand". Straight away FIRED?
@ljreinworth9 ай бұрын
The hesitation operator
@JBroMCMXCI8 ай бұрын
It’s just defining a tuple bruh it’s not a special operator 💀
@beng63197 ай бұрын
Guido, you've got some explaining to do!
@CrazyFlyKite8 ай бұрын
The Fire Operator
@bioblade878 ай бұрын
It doesn't have to be an under scroll, it can be any variable assignment eg *charArray, = 'python' It's a neat syntax to know.
@londospark781310 ай бұрын
I would call it the P45 because in the UK that's what you would get if you use it
@vxsniffer9 ай бұрын
more precisely, asterisk operator can be used only for elements in list or tuple, adding comma makes it single-element tuple
@Ctrl_Alt_Elite10 ай бұрын
Should be called the "melting wink" operator because it looks the right eye fell off while winking
@SchwopSchip-jh2hl5 ай бұрын
Its called the pistol operator, because it looks like an upside down pistol
@Indently5 ай бұрын
This video came before that one, but I’m happy you made it to the origin ahah
@kgtechs10 ай бұрын
its a sequence unpacking. We can use any character instead of ‘_’ it will considered as variable. e.g., *ab,=‘python’ and when you print ab it should give the same output. and comma indicates the tuple. when it will be processed we get the output in list.
@steamer2k31910 ай бұрын
The other commenters seem to agree with you. I'd call it "greedy" "destructuring assignment", though. I guess my JavaScriptyness is showing.
@rahul-thakare10 ай бұрын
Wink operator 😅
@JordanMetroidManiac10 ай бұрын
Spiritual successor of the walrus operator.
@josefkaras751910 ай бұрын
unpacking/star unpacking
@ziokam110 ай бұрын
I now feel more confused than before i saw this clip!
@Exvixcity10 ай бұрын
String Unpacking
@crashmatrix10 ай бұрын
I mean, it's just pattern matching with wildcard support thrown in, from a certain perspective.
@vodracseck10 ай бұрын
list("Python")
@HypnosisBear5 ай бұрын
Yeah that's more readable and understandable! 👍
@venkyman498510 ай бұрын
looks like the characters people put in comics when people are fighting
@MalikTheGeek07Ай бұрын
If i needed every single character in a string, id use a for loop 😭
@Sinke_10010 ай бұрын
Same as [*_] just unpacking
@Indently10 ай бұрын
The difference with this one is that it’s much more readable than “*_,”
@Sinke_10010 ай бұрын
@@Indently either way, this kinda content I really apriciate 🙂
@Indently10 ай бұрын
Happy to hear! I don't ever know who appreciates the crazy random syntax you can use with Python ahah
@lifeisfakenews10 ай бұрын
the Abomination Operator
@drrichardhertz8 ай бұрын
Deconstructed assignment
@zekenebel9 ай бұрын
The jobseeker
@jonathanlloyd868810 ай бұрын
This is cool like javascript unpacking. But i much rather simply cast the string to a list irl. 😂
@vikingthedude10 ай бұрын
It’s the one eyed kirby operator
@jackytaly10 ай бұрын
_ is not required, you could put any variable name in there: *a, = ‘Python’
@robinmaurer26459 ай бұрын
_ is used for stuff you get from a return but dont need.
@gameplay-gameplay10 ай бұрын
The splitter
@Terra_13510 ай бұрын
I like to call that the unpacking operator bc it essentially just unpacks sequences into multiple values
@nathansavage869210 ай бұрын
You use it?!
@Terra_13510 ай бұрын
@@nathansavage8692 sometimes, not like shown in the video but say if I have a tuple with arguments I want to pass to a function that has a *args, (or to make a *args function myself)
@kumar_prabhat10 ай бұрын
IT'S A WINKYYYYY
@shikanokonokokoshitantan4 ай бұрын
The `saw operator` it looks like a cutting saw and I just saw it.
@tycho112910 ай бұрын
I finally understood. Thx 🙏
@SCPokSecondaccound10 ай бұрын
I would call this the "help im having a stroke" operator
@malmiteria10 ай бұрын
... the unpacking operator?
@satyamARAS9 ай бұрын
Similar ,depends people avoid this now adays I guess.
@TheRythimMan8 ай бұрын
First thing i thought was "python has pointers?"
@fredericodargel991910 ай бұрын
There's a snake joke there somewhere, I can't just find it.
@samore1110 ай бұрын
Multiple assignment is crazy. How do they come up with this stuff?
@ShortFilmVD10 ай бұрын
Some lazy computer scientists who thought they were being clever 😂
@AWriterWandering10 ай бұрын
The pink slip operator.
@DrDeuteron10 ай бұрын
Took mine, but I don’t think zoomers know what pink slip is
@nothiiiiiiiing10 ай бұрын
unpacking operator, use it twice for dictionaries, its actually really useful when used correctly
@DoubleBob10 ай бұрын
When I use it once, I get a list of keys and using it on that list returns the same list. So the second time is redundant. Am I missing something?
@nothiiiiiiiing10 ай бұрын
@@DoubleBob my_dict = {"a":5,"b":6} def add(a:int,b:int): return a+b print(add(**my_dict)) # prints the result of 5+6
@DoubleBob10 ай бұрын
@@nothiiiiiiiingHuh. I didn't know that kind of feature exists. Not sure how practical this is as this would require the dictionary to have as many items as the function has arguments.
@acoupleofschoes3 ай бұрын
@@DoubleBob * is positional unpacking, so with a dictionary you get the keys. ** is keyword unpacking, you get the values in a dictionary.
@senzmaki489010 ай бұрын
The unpack operator is good if you use it the right way, for example if you have a function that returns a tuple of results and another that takes in the individual results you can directly unpack the results in the calls. e.g function2(*function1())
@_sleepy-10 ай бұрын
Wow thank you I didn’t know about unpacking in multi assignment I’ll probably never use it but I love coming across tricks I didn’t know
@Qwerkywoop8 ай бұрын
The grabber
@maztaim10 ай бұрын
The sad pink-eye.
@movax20h10 ай бұрын
comma is required, because what is on the left is reverse of tuple. so it must be tuple-like. similarly (x) is not a tuple, (x,) is
@Carberra4 ай бұрын
If *_ is the pistol operator, this should be the deagle operator!
@beerilevinger68869 ай бұрын
It should be called the fuQ operator, for obvious reasons.
@Andreas-gh6is9 ай бұрын
It's a destructuring operator on top of a spread operator...
@abdalmoniem.alhifnawy2 күн бұрын
the wink operator *_,
@justindevasia87549 ай бұрын
What is the Big '0' notation for this operation??
@xing32409 ай бұрын
useful for code golf ig, it is slower though
@ln92965 ай бұрын
Its called the gun
@johnmulhall06 ай бұрын
The drool operator
@lukanya312410 ай бұрын
It looks like a snail... Maybe snail unpacking?
@nicholasdavidacruz9 ай бұрын
Would the interpreter evaluate this weird assignment as the same as: = list() ?
@MyMomCallsMeCyb3rMan8 ай бұрын
This man, is a villain
@blackandwhitegamingproduct735610 ай бұрын
As a beginner to python, the easiest way to explain this would be that the asterisk is grabbing the string and storing the values to the underscore which then gets printed, correct?
@drewgraham10 ай бұрын
ye thats a decent way to explain it.
@no-name1688 ай бұрын
This actually looks like it has potential but I'd use it only in small readable functions and loops.
@solvital40686 ай бұрын
🔫 Pistol operator!
@emre_ez3 күн бұрын
When you write this PEP officials come to your house
@donwald34369 ай бұрын
python syntax that is forbidden: all of it lol.
@jki74499 ай бұрын
idk why but im feeling someting like “shmoog” or something idk.
@yeet383310 ай бұрын
that syntax already gave me headache
@ekuwam89899 ай бұрын
It’s a split operator
@hicklc018 ай бұрын
I would so use that if I needed to covert a string into a char array. Does it have to be a string literal or can it also be a string variable?
@auaisme9 ай бұрын
I would call it a parser.
@saaofficial541510 ай бұрын
The "starscore" operator
@tm00110 ай бұрын
More like "when you want to get fired"
@bryce-bryce9 ай бұрын
And why should this be illegal? Its a common use to catch return values that are not of interest avd this is an elegant way to do so
@Fakecloak9 ай бұрын
so what's the use of this syntax in real time?
@Deerbruh10 ай бұрын
The felony operator
@user-ey3uh7sw3g9 ай бұрын
Unpacking operator.
@zohaibanwer519910 ай бұрын
I would name this.. list pack operator 😅
@kvanctok92349 ай бұрын
The list-less list(str) op
@Karandhanwani10 ай бұрын
Soread operator maybe😅
@octubre_lilaka10 ай бұрын
Casts string to char[]
@kiryonnakira756610 ай бұрын
ocaml: finally a worthy opponent
@sedatmehmed437110 ай бұрын
I think it was called unpack operator
@antoninolorenzo121510 ай бұрын
As someone who don't knows python, even the first feels cursed
@jumo267010 ай бұрын
I thought the b was gonna be a pointer but I think python doesn't even support them
@angryparrot9 ай бұрын
Call it violence.
@PeterZaitcev2 ай бұрын
looks like one-eyed smile to me
@_a_977310 ай бұрын
Actually the _ is just a variable name same can be done as *x, = string.
@solomonlemma542610 ай бұрын
Why do u call it discusty code??
@dudib949 ай бұрын
One eyed unpacking
@alexander1912979 ай бұрын
The Swindler’s List… for you’re not a professional Python developer, but a mere swindler to commit such travesty!
@NeUrOmAnCeRAI9 ай бұрын
It should be called disgusting.
@teazer9999999 ай бұрын
It's called "don't write crazy code".
@AshutoshJatkar10 ай бұрын
So much in the name of being pythonic 😂
@potaetoupotautoe793910 ай бұрын
I see what you did there
@BlazeGamingUK4EVER9 ай бұрын
That syntax is called the sleep bag.
@ren137c10 ай бұрын
whats the "logic" behind how this works? my default way for the final result would be something like letters = [letter for letter in string], but uh, thats a lot quicker to type lmao. How "efficient" is it?
@ytlongbeach10 ай бұрын
you're fired
@thatstupiddoll10 ай бұрын
It's a tuple literal of one element
@jamesstrand12310 ай бұрын
it should be called the wannabe c++ syntax typer
@erikblaas58269 ай бұрын
I would call this opperator "Trashcan" , because it can consume about everything...