[Tutor] Strange "snippets" in Learning Python, 2nd ed.

Andrei project5 at redrival.net
Sun Aug 21 00:30:26 CEST 2005

Dick Moores wrote:
> I have the first printing. The snippets are on pp. 159 and 160, and are 
> there to illustrate the loop "else" clause.
> while x:                         # exit when x empty
>      if match(x[0]):
>          print 'Ni'
>          break                    # exit, go around else
>      x = x[1:]
> "match()" seems to come out of the blue, and also "Ni". Or have I 
> misunderstood something?

I can't tell you where match() comes from - perhaps it's just a dummy 
name of a function the purpose of which is left to the imagination of 
the user. I don't think it's important actually, the point would be that 
it returns True if some criterium is met and False otherwise.

"Ni" comes from a Monty Python movie. The name of the Python language 
comes from Monty Python, hence the reference to the movie. For more 
info, google for "knights who say ni". It's quite traditional in the 
Python world to include Monty Python references in code or even program 
names. References to idle, eric, spam, dead parrots, shrubberies, 
cleese, grails, the Spanish inquisition, swallows and just about 
anything else that seems weird can usually be tracked down to that same 



Mail address in header catches spam. Real contact info (decode with rot13):
cebwrpg5 at jnanqbb.ay. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V 
ernq gur yvfg, fb gurer'f ab arrq gb PP.

More information about the Tutor mailing list