Changing python grammar to support standalone walrus assignments

preview_player
Показать описание

Build Your Own Redis / DNS / BitTorrent / SQLite - with CodeCrafters.

In the video, I explained the introduction of the walrus operator in Python version 3.8, which enables assignment expressions. These expressions assign a value and return it for reuse, making code more readable and intuitive. By delving into Python's grammar, I identified why a simple assignment expression like a colon equal to 10 results in a syntax error. I modified the grammar to allow this syntax, demonstrating how to make the code work as intended. This process involved understanding Python's grammar rules and making necessary adjustments to resolve the syntax error.

# Recommended videos and playlists

If you liked this video, you will find the following videos and playlists helpful

# Things you will find amusing

# Other socials

I keep writing and sharing my practical experience and learnings every day, so if you resonate then follow along. I keep it no fluff.

Thank you for watching and supporting! it means a ton.

I am on a mission to bring out the best engineering stories from around the world and make you all fall in
love with engineering. If you resonate with this then follow along, I always keep it no-fluff.
Рекомендации по теме
Комментарии
Автор

Probably the first time I’ve ever seen someone deep down into the language internals. Very insightful 👍

shubhamdalvi
Автор

This is impressive, and really unorthodox way of teaching. Keep it up man!

theprodev
Автор

Really interesting, now when everybody is getting crazy for new libraries and framework, loved this low level stuff

rahulpalve
Автор

This is so insightful on how a lot of stuff works

antoneyabraham
Автор

I am suffering from imposter syndrome and watching you diving deep into the code felt like wow this guy but when you said: "I don't know this but when I do we will talk about it." I instantly subscribed.

fawadbros
Автор

Thanks Arpit sir helps a lot, you gained one more subscriber🙌

novelkathor
Автор

Not sure if anyone tried to update the walrus operator 16:45.. but looks like for me upon the same changes on branch 3.8 it gives this python: Python/ast.c:3463: ast_for_expr_stmt: Assertion `TYPE((&(n)->n_child[1])) == (22)' failed.
[1] 36689 IOT instruction (core dumped) ./python

anishkelkar
Автор

this is beyond words to me, will you be adding more duch discussion to the series?

rp
Автор

Tip: Make a playlist by the name of Hard parts of python or weird parts of python. Why? because you will get massive hits like hard parts of javascript and weird parts of javascript series.

fawadbros
Автор

When you modified the walrus operator, it does not return the value while it should right?
Why?

heisenbergwhite
Автор

Really enjoyed it!
But how do you know all this?
Where did you learn it?
How do we come to your level😅

heisenbergwhite