⚡ 5 Horrifying Python Techniques to get you fired - Andrew L

preview_player
Показать описание
Python is a great language, with a few... cursed exploits. While a lot of implementation details make it easier to work with, they also lead to quirks - quirks which can be exploited for fun (and profit?). Whether it's variables, match statements, type hinting, imports, or even just trying to fit everything on one line, this talk has more than a few slithering tricks up its sleeve.

Talk by Andrew L.

Some explanations:

00:00 - Introduction
02:45 - Variable Binding
04:35 - Variable Unbinding
06:08 - Annotations
08:26 - One Line
12:07 - Importing
Рекомендации по теме
Комментарии
Автор

This is so cursed. I've never felt in this way since the day someone told me that in C, "a[10]" is identical to "10[a]".

arduous
Автор

I'm sure the Python maintainers would love to see you using their language like this

probablykeegan
Автор

"one plus one is two, and now there's a module called two" 😰 I've seen a lot of cursed python, but that might take the cake

defenestrated
Автор

Fuckit is truly one of the most cursed libraries out there. Kudos to the creator for their creativity.

Bobbias
Автор

What got me fired is writing pythonic code.
Because the 'expert' / team-lead learned Java once and hated everything that didn't look like Java.

alexd
Автор

How the entire room wasn't just erupting in laughter the whole talk long! I was convinced you must have given this presentation over Zoom or something up until the end.

GSBarlev
Автор

Only a person who loves Python would put that much work into a video. Nice job.

BrianStDenis-pjtq
Автор

Every language has shenanigans because EVERY abstraction is leaky.
Python just happes to have particularly fun ones because it tries to do so much.

martixy
Автор

14:55 "One is just a module, there's nothing funny going on here" is delivered just perfectly while I'm still dying of laughter over the "fuckit" module

thunder____
Автор

So that's what "modular arithmetic" means!

xsaiko
Автор

So in other words, you have to be an expert at python in order to get fired.

Exius-Zero
Автор

I feel like Bertrand Russell would like a word about that list containing itself.

stapler
Автор

Woah this talk is going a billion miles a minute. I need to pause it all the time to understand the point that's being made 😅

Xeno
Автор

For any new code golfers out there, use __import__("module") instead of normal import because it saves a byte.

Unless golfing, shy away from it.

RexVelde
Автор

Import replacement is super useful in large codebases because it enables aliasing two import paths to the same package. That lets you move/rename packages without doing it as a single monolithic change.

iniom
Автор

Just seeing the 'fuckit' library made this worth the watch.
For anyone wondering there is a context manager that can do the same thing, but it's not as funny.

thisoldproperty
Автор

While not as nuanced as pretty much any point made in this talk, I'll join in and share my personal favorite "python wat?" entry. This one has the added bonus of being something a programming polyglot might actually run into and have an existential crisis over.

Due to the way it handles scope, the _lambda_ expression does not support true closures. But python will try its absolute best to _pretend_ that it does. That means that depending on usage, variables shared across closures will influence each other seemly through pure magic if you're expecting an actual closure.

[(lambda x: x + y) for y in range(10)] # has some unfortunate behavior

And you can make the above a _lot_ more cursed.

Hulan
Автор

This was hilarious & informative 🤣 Python has some cursed shenanigan gems indeed

bryanbanda
Автор

This was a great talk, very well done

RyanMorey
Автор

I really didn't expect the spanish inquisition

hdpu