Page 105 -
P. 105

sharing your code





              A final test of the functonality should convince you that your module is now working exactly the way you and your
              users want it to. Let’s start with the original, default behavior:

              >>> names = ['John', 'Eric', ['Cleese', 'Idle'], 'Michael', ['Palin']]
              >>> print_lol(names)
              John
              Eric                  The original, default functionality
                                    is restored (that should please
              Cleese                Bob).
              Idle
              Michael
              Palin
              Next, turn on indentation by providing True as the second argument:

              >>> names = ['John', 'Eric', ['Cleese', 'Idle'], 'Michael', ['Palin']]
              >>> print_lol(names, True)
              John
              Eric                          By providing a second argument,
                     Cleese                 it’s possible to switch on indented
                     Idle                   output (keeping Laura happy).
              Michael
                     Palin
              And, finally, control where indentation begins by providing a third argument value:

              >>> names = ['John', 'Eric', ['Cleese', 'Idle'], 'Michael', ['Palin']]
              >>> print_lol(names, True, 4)
                                           John
                                           Eric
                                                                  Indenting from a specific
                                                  Cleese          tab-stop is also possible.
                                                  Idle
                                           Michael
                                                  Palin







                                                                                 Go ahead and edit your
                                                              Do this!           setup.py file; then upload
                                                                                 your distribution to PyPI.



                                                                                       you are here 4    69
   100   101   102   103   104   105   106   107   108   109   110