On May 7, 9:07 am, [EMAIL PROTECTED] wrote: > ''' > On May 6, 4:43 pm, [EMAIL PROTECTED] honoring: > > >>> a.next( ) > ( "I", ) > >>> a.throw( up ) > ( "I", "A" ) > >>> a.next( ) > ( "I", "B" ) > >>> a.next( ) > ( "I", "C" ) > >>> a.throw( down ) > > ( "II", ) > ''' > > #funny declaration > class up( Exception ): pass > class down( Exception ): pass > > def outline( ): > stack= [ 1 ] > while 1: > try: > yield stack > stack[ -1 ]+= 1 > except up: > stack.append( 1 ) > except down: > stack.pop( -1 ) > stack[ -1 ]+= 1 > > a= outline( ) > print a.next( ) > print a.throw( up ) > print a.next( ) > print a.next( ) > print a.throw( down ) > print a.throw( up ) > print a.throw( up ) > print a.next( ) > print a.next( ) > print a.throw( down ) > > ##output: > > [1] > [1, 1] > [1, 2] > [1, 3] > [2] > [2, 1] > [2, 1, 1] > [2, 1, 2] > [2, 1, 3] > [2, 2] > > ## > > cf. > > formatter.NullFormatter.format_counter > formatter.NullFormatter.format_letter > formatter.NullFormatter.format_roman
One execution of Python 3a4 included in built-ins. Python 3.0 win32 Type "help >>> next <built-in >>> Do you want send and throw in it too? -- http://mail.python.org/mailman/listinfo/python-list