Posted on

Duck typing in python

When I see a bird that walks like a duck and swims like a duck and quacks like a duck I called that bird a duck

J. W. Riley

The Python code language is dynamically typed. In many languages (C++, Java) you do need to explicitly declare the types of variables. Python uses duck typing for all operations (function calls, method calls, and operators). You can treat an object as a duck. It raises a TypeError at runtime if an operation cannot be applied to an object because it is of an inappropriate type.

Posted on Leave a comment

Monty Python and the Holy Grail – Bridge – Three Questions

Monty Python and The Flying Circus

Monty Python

Monty Python (also collectively known as the Pythons) were a British surreal comedy troupe who created the sketch comedy television show Monty Python’s Flying Circus, which first aired on the BBC in 1969. Forty-five episodes were made over four series. The Python phenomenon developed from the television series into something larger in scope and influence, including touring stage shows, films, albums, books and musicals. The Pythons’ influence on comedy has been compared to the Beatles’ influence on music. Regarded as an enduring icon of 1970s pop culture, their sketch show has been referred to as being “an important moment in the evolution of television comedy”. — Source: Wikipedia

Monty Python and the Holy Grail - Bridge - Three Questions

Bridgekeeper: Stop. Who would cross the Bridge of Death must answer me these questions three, ere the other side he see.
Sir Lancelot: Ask me the questions, bridgekeeper. I am not afraid.
Bridgekeeper: What… is your name?
Sir Lancelot: My name is Sir Lancelot of Camelot.
Bridgekeeper: What… is your quest?
Sir Lancelot: To seek the Holy Grail.
Bridgekeeper: What… is your favourite colour?
Sir Lancelot: Blue.
Bridgekeeper: Go on. Off you go.
Sir Lancelot: Oh, thank you. Thank you very much.
Sir Robin: That’s easy.
Bridgekeeper: Stop. Who would cross the Bridge of Death must answer me these questions three, ere the other side he see.
Sir Robin: Ask me the questions, bridgekeeper. I’m not afraid.
Bridgekeeper: What… is your name?
Sir Robin: Sir Robin of Camelot.
Bridgekeeper: What… is your quest?
Sir Robin: To seek the Holy Grail.
Bridgekeeper: What… is the capital of Assyria?
[pause]
Sir Robin: I don’t know that.
[he is thrown over the edge into the volcano]
Sir Robin: Auuuuuuuugh.
Bridgekeeper: Stop. What… is your name?
Galahad: Sir Galahad of Camelot.
Bridgekeeper: What… is your quest?
Galahad: I seek the Grail.
Bridgekeeper: What… is your favourite colour?
Galahad: Blue. No, yel…
[he is also thrown over the edge]
Galahad: auuuuuuuugh.
Bridgekeeper: Hee hee heh. Stop. What… is your name?
King Arthur: It is ‘Arthur’, King of the Britons.
Bridgekeeper: What… is your quest?
King Arthur: To seek the Holy Grail.
Bridgekeeper: What… is the air-speed velocity of an unladen swallow?
King Arthur: What do you mean? An African or European swallow?
Bridgekeeper: Huh? I… I don’t know that.
[he is thrown over]
Bridgekeeper: Auuuuuuuugh.
Sir Bedevere: How do know so much about swallows?
King Arthur: Well, you have to know these things when you’re a king, you know.
[the Black Knight continues to threaten Arthur despite getting both his arms and one of his legs cut off]
Black Knight: Right, I’ll do you for that!
King Arthur: You’ll what?