Python Notes

The page is about Python wierdnesses that I've encountered.

  • The continue statement is a little wierd:
    while (running):
       for n in range(10):
           try:
              foo()
           except Exception, e:
               print(exc_type, fname, exc_tb.tb_lineno)
               continue
    

    behaves like :

    while (running):
       for n in range(10):
           try:
              foo()
           except Exception, e:
               print(exc_type, fname, exc_tb.tb_lineno)
       continue
    

    So, the continue in both cases refers to the while(running)

  • Passing by parameter vs value is based on mutable vs non-mutable data. Stupid. Or at least I don't get the reasoning.


Not yet rated