Posted to tcl by oldlaptop at Wed Jul 27 02:22:19 GMT 2022view raw

  1. $ python3
  2. Python 3.10.5 (main, Jun 8 2022, 02:00:39) [GCC 10.2.1 20201203] on linux
  3. Type "help", "copyright", "credits" or "license" for more information.
  4. >>> dirCols = ['foo', 'bar', 'baz']
  5. >>> fileCols = [ 'spam', 'ham', 'egg']
  6. >>> class things:
  7. ... def heading(self, *args, **kwargs):
  8. ... print(args, kwargs)
  9. ...
  10. >>> dirs = things()
  11. >>> files = things()
  12. >>> [ dirs.heading(c, text=c.capitalize()) for c in dirCols]
  13. ('foo',) {'text': 'Foo'}
  14. ('bar',) {'text': 'Bar'}
  15. ('baz',) {'text': 'Baz'}
  16. [None, None, None]
  17. >>> [files.heading(c, text=c.capitalize()) for c in fileCols]
  18. ('spam',) {'text': 'Spam'}
  19. ('ham',) {'text': 'Ham'}
  20. ('egg',) {'text': 'Egg'}
  21. [None, None, None]
  22. >>>