A Crazy Python Dictionary Expression ?!

Publié le: 31 janvier 2017
sur la chaîne: Real Python
27,903
602

https://dbader.org/python-tricks ► Master advanced features in Python with free & easy to digest code examples

We're going to pry apart this slightly unintuitive Python dictionary expression to find out what’s going on in the uncharted depths of the Python interpreter.

A while ago I shared a Python one-liner as a “Python riddle” on Twitter and it got some interesting reactions:

{ True: 'yes', 1: 'no', 1.0: 'maybe' }

Take a quick moment to think about what this dict expression will evaluate to.

You might be surprised...

Watch the video or read the full article to learn more about Python dictionaries, hashing and key collisions: https://dbader.org/blog/python-myster...

FREE COURSE – "5 Thoughts on Mastering Python" https://dbader.org/python-mastery

SUBSCRIBE TO THIS CHANNEL: https://dbader.org/youtube

* *

► Python Developer MUGS, T-SHIRTS & MORE: https://nerdlettering.com

FREE Python Tutorials & News:
» Python Tutorials: https://dbader.org
» Python News on Twitter:   / @dbader_org  
» Weekly Tips for Pythonistas: https://dbader.org/newsletter
» Subscribe to this channel: https://dbader.org/youtube


Sur cette page du site, vous pouvez voir la vidéo en ligne A Crazy Python Dictionary Expression ?! durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Real Python 31 janvier 2017, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 27,903 fois et il a aimé 602 téléspectateurs. Bon visionnage!