>>> print([i for i in range(10) if i < 6 if i % 2 == 0])
Why is this allowed?
>>> print([i for i in range(10) if i < 6 if i % 2 == 0])
Why is this allowed?
Other urls found in this thread:
I agree. Python should be banned.
wtf, why does multiple ifs work?
Python was probably an invention of the KGB because ".py" looks like the Cyrillic py (ru)
She's a thicc, dirty girl.
Oh yes it all makes sense now
First time I know that too
Fucking bigot. Girls can be programmers too.
how did she even take the photo with both hands on the keyboard?
Hmmmm
print( range(10).filter(lamba i: i < 6).filter(lamba i: i % 2 == 0).into(list) )
would be so much nicer style
>>> len('print( range(10).filter(lamba i: i < 6).filter(lamba i: i % 2 == 0).into(list) )')
80
>>> len('print([i for i in range(10) if i < 6 if i % 2 == 0])')
52
No
post the past 10 lines in your bash history, no cleanup
MILKIES
You have no idea...
youtube.com
That's actually a chilling question
That's becuase nobody ever has to use multiple consecutive ifs in a listcomp, when the 'and' operaror exists.
>lamba
I discovered this by accident, via copy/paste. Meant to wright and, but noticed the typo after I ran the code. I've been writing python professionally for nearly a decade, so it's rare that I encounter surprising syntax.
Tbh it can be helpful for code golf
ITT brainlets who can't comprehend functional programming and filters.
>threadly reminder that python 3.x is not pythonic
>lamba
i hate codacedmy fags so godamn much
Maybe she had her phone on a tripod and did a countdown snapshot. Or maybe someone else took it for her, idk.
How did I never notice this?
she sat at her desk with a gopro on
real ass street programming sheit nigga
I know it's not "pythonic", I bet python's lambdas are expensive as fuck. My point was that chaining iterators is leaner than list comprehensions. Neither is nice in python though.