@@dustysparks it is to be able to put more than one expression in a single line example:$ x=1;x=2 print(x) Most Code editors supporting Python will highlight the semicolon in red unless you put an expression after it.
@@felixthehuman Readability. Polish and reverse polish notations have nice properties. But they're harder to read than the infix notation with redundant bracket elimination.
I hadn't seen greenbar printer paper in 25 years, then I started watching Computerphile. I didn't realize they still made it, or printers that can print on it :)
Many whiteboard pens get very hard to wipe away if you let them stay on the whiteboard too long. Maybe it's just the cheap ones, but that's my experience anyway.
Warning: Liberally apply lotion prior to watching, to avoid Prof. Altenkirch's dry humor from shriveling you into a human Triscuit. P. S. - You are hilarious and informative. Love your videos.
4 роки тому+4
I never really (as in REALLY) felt the meaning of dry humor. Thanks to this video I now have something to illustrate the lunar-desert variety.
@@talhatariqyuluqatdis In Python, you can construct strings from variables by writing e.g. f"The number is {numberVariable}" It looks arguably nicer than "The number is " + str(numberVariable)
At first when he said it's bad to copy code, my reaction is "what the heck is wrong with you?" But then I realized he's basically talking about DRY (don't repeat yourself) vs copy and paste. Sanity restored.
Yes in fact, my experience is that it makes a huge difference in terms of maintainability of the code when you factor out repeated or almost repeated code.
@@ecicce6749 If you literally copy and paste, that's bad. But if by "copy" you mean "transcribe", it's fine. Just make sure you understand what you're using.
@@cshairydude We need to start using trees more often in Python. They are abundant on this planet and frankly wouldn't be missed. Brackets are now an endangered species.
This makes complete sense, he’s building a partial interpreter by creating a parse tree and evaluating the tokenized expression that he self Lexed by hand
I really liked viewing this video after I learned about the compiler compilation method and how it basically breaks apart into various trees via tokens to represent data and special characters to compute processes. So watching this video after learning about that was a nice connection.
This is why node-based editors for various applications are so great. No more worrying about order of operations of figuring out how many brackets to type!
If you make a BinaryOper as a subclass of Expr, you can give it the __init__(self, l, r) function that you typed for Plus and Times, and make those subclasses of BinaryOper
Give each class a precedence property, and then the use of parentheses around each expression in its str form can be added or not based on comparison of its precedence with the precedence of its parent
"there is only a limited number of brackets in the world, we try to save brackets, its a bracket saving device" Get this man a podium, I wanna see him advocate more for bracket rights!
"trees in computer science are upside down". Many say this, but there is nothing relating to orientation in the computer or the math. It's just the way we generally draw them. Most useful ways to construct a tree are from the root and we tend to draw them the same way we write.
@3:18 I never delete a bracket. I keep a file where I paste brackets whenever I cut them, for later use. ♻ Maybe I should scale that effort up and turn it into a REST interface and a vim plugin bound to x that will send them online for everyone to reuse... A question to UA-cam chat, should that use the POST verb or the PUT verb? I'm afraid the idempotency of PUT might break brackets beyond reusability.
You can recognize which element come first in a tree, by asking which one of the derivative rules come first, as in if i am going to derivate this expression which operation come first.
Since this is an AST, __str__ is appropriate for printing out the expression itself (the concrete syntax). If you're following the "should print out something that can recreate the object when passed to eval", __repr__ should return a string of chained constructors, e.g. "Times(Const(3), Plus(Var("X"), Var("Y")))", which would look similar to how an AST is constructed in, e.g., functional languages with Algebraic Data Types.
Dear Professor Thorsten Altenkirch, thank you so much for this. Is there going to be a part two to this? Are you going to extend the interpreter any further?
I'd like to see a Computerphile-Advanced channel where we get to see more of what the instructors are really working on.
"there is a limited amount of brackets in the world, and we try to save them"
*looks at Lisp with anger*
Thankfully, TCO lets us reuse our parens, they are weapons of a more civilized age after all...
I love these videos withe Professor Thorsten, they are very educational and informative while also serving as a sort of ASMR.
his voice is weirdly soothing
The best relaxed style, making coding obvious and fun
"I broke the first rule of programming and that is copying code. There are of course some exceptions, like if you're a professor"
@Jaxon Valentino stop scamming people dickhead
the first rule should be "your code is never unique just copy from others and make sure it works correctly by yourself
@@freezedTIM horrendous mentality
As a senior dev I too take exceptions
@@Xx_Eric_was_Here_xXthat’s literally what the workplace is like what are you saying?
‘Very exciting! I always wanted to know where my _Times()_ object lives, in case I want to visit it…’
- Professor Thorsten Altenkirch
Thorsten's deadpan humor is great. I get the feeling that even the cameraman didn't catch all of his humorous little absurdities.
Why are pple complaining. I can hear this man fine with no confusion.
He does have an accent, but I can still understand him fairly well
same here
I understand him just fine and english is my second language. If you want confusing check the whiteboard.
Que ? Nani? Wut?
I like his accent but I can understand people not being able to. We aren't all taught the same language and accents throughout the world.
The fact that he doesn't put spaces after his commas but does around his colons makes me very upset.
LOL yeah that is utter madness
I still put semicolons at the end of lines instinctively from c++/c#, but it's legal... and it's clearer to me at least
@@dustysparks it is to be able to put more than one expression in a single line
example:$
x=1;x=2
print(x)
Most Code editors supporting Python will highlight the semicolon in red unless you put an expression after it.
I don't put spaces after comma because I'll type much slower
@@XDTuber Most of my code is autocompleted.
thorsten is a really interesting guy. got to meet him in poland a few weeks ago, and it was an honor!
3:18 Just use renewable brackets. Sustainable mathematics.
You should also check if your brackets were raised under appropriate conditions and not in a disgusting bracket factory.
Organic curly brackets and such, my Semi Colons are grown in my own garden.
0:00 Ja... Gotta love Thorsten 😍
SAVE THE BRACKETS!
@@perfumedmanatee6235 RPN vs prefix notation: who will win?
@@felixthehuman Readability. Polish and reverse polish notations have nice properties. But they're harder to read than the infix notation with redundant bracket elimination.
@@Ceelvainwhat is a redundant bracket? Are we counting on readers to know the order of operations?
@@felixthehuman Of course.
Not only they should know. But the context also help making sens of the expressions.
And then he writes a line of code with 10 brackets :D 9:18
I hadn't seen greenbar printer paper in 25 years, then I started watching Computerphile. I didn't realize they still made it, or printers that can print on it :)
Oh dear! Looks like someone accidentally bought permanent markers for his whiteboard!!
Just use a regular whiteboard pen on the permanent ink and you can remove it
@@SupraTreck or some alcohol
Many whiteboard pens get very hard to wipe away if you let them stay on the whiteboard too long. Maybe it's just the cheap ones, but that's my experience anyway.
@@SupraTreck How does this work?
@@leo848 Most likely the alcohol in the ink
This is my single favorite Python video. Huge thank you to Professor Altenkirch for sharing with us!
Warning: Liberally apply lotion prior to watching, to avoid Prof. Altenkirch's dry humor from shriveling you into a human Triscuit.
P. S. - You are hilarious and informative. Love your videos.
I never really (as in REALLY) felt the meaning of dry humor. Thanks to this video I now have something to illustrate the lunar-desert variety.
imagine concatenating lots of little parts of strings and variables together
this post by the f-string gang
Wots an f string
@@talhatariqyuluqatdis The best thing to ever been introduced to Python.
@@talhatariqyuluqatdis In Python, you can construct strings from variables by writing e.g.
f"The number is {numberVariable}"
It looks arguably nicer than
"The number is " + str(numberVariable)
i worship the superior "".format()
@@yeyu8521 on python3.6+, f-string much much faster than str.format().
I remember the part in Independence Day when this guy was killed by one of the aliens in Area 51.
That's where I saw him before ;)
No no no. That was lieutenant commander Data of the USS Enterprise
Actually he wasn't for some reason...
At first when he said it's bad to copy code, my reaction is "what the heck is wrong with you?" But then I realized he's basically talking about DRY (don't repeat yourself) vs copy and paste. Sanity restored.
Yes in fact, my experience is that it makes a huge difference in terms of maintainability of the code when you factor out repeated or almost repeated code.
copy and paste in my experience is causing 80% of the bugs and errors in code though
@@ecicce6749 If you literally copy and paste, that's bad. But if by "copy" you mean "transcribe", it's fine. Just make sure you understand what you're using.
Wait, in all this time nobody made the pun about him having DRY humour?
Didn't know there was a bracket shortage. I'll be leaving them out of all my code now !
He's going on outdated standards. We've moved on to BPv6 and can handle 2^128 brackets now.
That's also the reason he uses Python: no curly brackets, aka the 'endangered' brackets.
Bert Raeymaekers dictionaries want to talk to you
I didnt understand this.
Try Rust. The compiler will politely ask you to remove superfluous brackets.
Cries in pep-8 some more...
Oh no, not again!
"Pep8 unto thyself, not unto others" - Raymond Hettinger
@@dariuselijah9277 it still hurts
This video has taught me that Jupyter notebooks should really support linting for PEP 8 by default
Lol yes
I love his dry humor
19:35 "twölf" ...thats awesome!
this just made me crack up... thanks man
This guy is great! Love how he made me think for a split second that he wanted to evaluate Ivan. I was like "Who is Ivan? The cameraman?"
Imaging me watching the video at half past midnight almost falling asleep and woke up shocked when heard my name 😄
Thank goodness Thorsten has finally brought the great bracket shortage to the public’s attention. Maybe something will get done now!
Perhaps by coding in Python we can covert all the braces we're saving into precious brackets.
@@cshairydude We need to start using trees more often in Python. They are abundant on this planet and frankly wouldn't be missed. Brackets are now an endangered species.
I see a pipBoy, I upvote. I'm a man of culture.
I absolutely love his dry humor. Save the brackets! And don't forget about the exceptions about copying code! Professors can copy code!
us germans have a great sense of humor, haha
Profs can copy code! Reminds me of a colleague who convinced his children that the car stereo would only play grown-up cassettes (back in the 90s)
😂
This makes complete sense, he’s building a partial interpreter by creating a parse tree and evaluating the tokenized expression that he self Lexed by hand
3:20
i still remember the big brackets shortage of the 80's
never again
Denglisch ist immer wieder schön zu hören ;)
Englisch mit deutschem Akzent ist nicht Denglisch.
Denglish < "Nämberch English Spoken"
Nein, Dänglisch ist was die Dänen eine Mischung von Englisch und Dänisch nennen
uni-denglisch lets go
I thought this is how french accent works...
Everyone else: Save the Trees!
Professor Thorsten Altenkirch: Save the Brackets! 3:18
love the way he pronounces r
ze Germans...
ツMichel He is from spain
BankOfTrust NWOBOT Are you kidding?
p - "hlch" - lint, it's oddly satisfying
@@bankoftrustnwobot3218 yeah nah. He's not
I really liked viewing this video after I learned about the compiler compilation method and how it basically breaks apart into various trees via tokens to represent data and special characters to compute processes. So watching this video after learning about that was a nice connection.
I love listening to him so much that I bought his book to add to my Python collection. Only issue is, I don't hear his voice talking when I read it.
I don't think an audio book version would catch on... :-)
Gutteral "print" 11:07
the hero we need but don't deserve
Pğiinnt
This is why node-based editors for various applications are so great. No more worrying about order of operations of figuring out how many brackets to type!
„This is why i‘m behind the camera“ i really felt that one 😂
I love the way he teaches! We want next video on machine learning
I want more of this *LEGEND* videos I wish we had professor like him in our college.
This guy is hilarious (both his humor and his mannerisms). Also very clever
If you make a BinaryOper as a subclass of Expr, you can give it the __init__(self, l, r) function that you typed for Plus and Times, and make those subclasses of BinaryOper
Give each class a precedence property, and then the use of parentheses around each expression in its str form can be added or not based on comparison of its precedence with the precedence of its parent
Nicely said!
"there is only a limited number of brackets in the world, we try to save brackets, its a bracket saving device"
Get this man a podium, I wanna see him advocate more for bracket rights!
That's quite interesting, I never thought of the math expressions like that
The next step would be writing a function that reads the expression as a string and creates the corresponding tree!
*Professor Brailsford has entered the chat*
How do you do that?
The Joy of Live Coding
I'd order the whole blu-ray box. All 31 seasons.
In this video especially the end about using this structure to generate derivatives is very interesting
Really enjoy your videos with Professor Altenkirch! He makes complex subjects easy to understand and fun to learn about.
K but why did he draw the reddit snoo on his whiteboard?
Because sometimes, you just need more snoo
@@davidschroeder3731 Fair enough
Where was this video when I was failing last year
def not on youtube since it was just posted. sry, had to.
5:25 humble camera man ))
Trollface.exe прав. Знаешь periodicvideos?
what?
I love how messy the whiteboard is
My concepts of trees got cleared after watching this video. 👍👍👍
"trees in computer science are upside down". Many say this, but there is nothing relating to orientation in the computer or the math. It's just the way we generally draw them. Most useful ways to construct a tree are from the root and we tend to draw them the same way we write.
Came to the comments to write this ;)
Another example of lunar dry humor
I 100% thought this was a joke video when I saw the thumbnail but then I realized it's not and stayed for the knowledge.
came for python, stayed becouse of the accent :D digga i cant even
wia luking et trieß!
@@infernocaptures8739 piepel mäy ßink siß iß ä dschook
@JAFFE KīkëSTEIN BLAHA parsertongue :)
@@infernocaptures8739 😂😂😂
I'd love to program and smoke trees with this professor
Allah akbar kaboom
@3:18 I never delete a bracket. I keep a file where I paste brackets whenever I cut them, for later use. ♻ Maybe I should scale that effort up and turn it into a REST interface and a vim plugin bound to x that will send them online for everyone to reuse... A question to UA-cam chat, should that use the POST verb or the PUT verb? I'm afraid the idempotency of PUT might break brackets beyond reusability.
Öttinger intensifies
Funny enough I have to create a parser with a parse tree for class, and this video just popped up.
"Trees are a bracket-saving device.." So nice of you to be environmental with your brackets.
This is really a PSA to start recycling brackets. ♻
P. S. Great talk as always.
Me: What are we talking about today?
Prof: Trees
Me: Bless you.
The panning on the screen capture at 14:57 was intense. 😮
I think i have never heard a stronger german accent.
I love it
Professor Thorsten Altenkirch is my favorite Ed Bassmaster character
This man just casually did the first steps of a compiler.. tokenize and parse
You can recognize which element come first in a tree, by asking which one of the derivative rules come first, as in if i am going to derivate this expression which operation come first.
Everytime I see a new altenkirch video I haven't seen my mind reads the title in his accent
OK, I'll say it. Professor Thorsten looks like Dave Grohl's elder brother.
Gefühlt der Deutscheste der Deutschesten
LSD dealing uncle.
imagine not catching type errors until runtime.
this post by the type annotations gang
edit: did say typing.py, but apparently typing has gone native
@@pilattebe, very great. that means there's even less of an excuse to not do type annotations.
Imagine having mutation and an ad hoc type system. This post brought to you by the Haskell cabal.
@@Axman6 Haskell master race LOL
Imagine using English for writing code.
FF 0F A1 B8 99
Alex Mason How nice is writing tree structures and functions on them in Haskell, eh? 😍 ADTs are nice
*CIRES IN PEP8*
also use __repr__, not __str__ for formal representations, which is what the goal here would be.
Since this is an AST, __str__ is appropriate for printing out the expression itself (the concrete syntax). If you're following the "should print out something that can recreate the object when passed to eval", __repr__ should return a string of chained constructors, e.g. "Times(Const(3), Plus(Var("X"), Var("Y")))", which would look similar to how an AST is constructed in, e.g., functional languages with Algebraic Data Types.
I need the machine learning video he's talking about in the end!
Hey I have some spare brackets, you can copy these (((
sorry I only have the left ones
I have some curly right brackets left from some program I wrote before. But hey if you can't remember, it's probably not important right?
if you only have left brackets left, then it makes it squared left, I cannot use then :(
A few weeks ago my '[' didn't work anymore, but I had to finish the code so I literally had to copy the '[' everytime from the previous code.
I think he should go by Professor Lorax since he speaks for the trees
This reminds me of mathologer seeing a cube in a state based system. He can see something that many of us can't immediately recognize.
I never knew, the scientist from "Independence Day" was really a scientist!
You mean 'DATA' from Star Trek Next Gen
This is what a programming geek should look like!!!
His dry parenthesis saving joke had me rolling
I think Professor Altenkirch just does these videos to sell his book, and it works I bought his book :D
This is an very helpfully video!
It's like Arnold teaching you Python without actually touching the 🐍
Great presenter, Great information - Thanks! Please do more with the Prof.
Thanks for yet another great video. I really wished it continued after 21 minutes... Or is it a cliffhanger?
Dear Professor Thorsten Altenkirch, thank you so much for this. Is there going to be a part two to this? Are you going to extend the interpreter any further?
This dude is awesome
It would have been very interesting to hear how he would implement derivation of algebraic expressions.
geralt in alternate universe
9:57 oh my that keyboard is dirty.
This Professor Thorsten is hilarious. The camera is shaking so much because the camera person is laughing so much.
Why does it edited like an episode from The Office ....!!!???
The witheboard is my brain at 2 am when i am trying to fall asleep
I watch these as much for the content as for the zen. So much zen.
This guy seems like he'd be cool to hang out with.
He looks like every Hollywood super villains computer guy.
7:05 "never copy code "
StackOverFlow : am i a joke to you ?
he is talking about having duplicate code inside one program, not about copying code from other sources...
@@m.h.6470 you obviously dont spend enough time on the internet to realize it was a joke bro ....
@@m.h.6470 *Am i a joke meme* : am i a joke to you ?
This question has been answered elsewhere already. You should really Google this stuff before submitting a new question.
@@fouzaialaa7962 there is the internet and THE internet... i usually stay away from the latter, as it mostly entails brain cell loss.
He is really computer maniac, catch my like bro
What's your bracket footprint?
If this video had come out a couple of days before I would have aced an S/W interview with Amazon