Posted to tcl by oldlaptop at Wed Jul 27 02:22:19 GMT 2022view raw
- $ python3
- Python 3.10.5 (main, Jun 8 2022, 02:00:39) [GCC 10.2.1 20201203] on linux
- Type "help", "copyright", "credits" or "license" for more information.
- >>> dirCols = ['foo', 'bar', 'baz']
- >>> fileCols = [ 'spam', 'ham', 'egg']
- >>> class things:
- ... def heading(self, *args, **kwargs):
- ... print(args, kwargs)
- ...
- >>> dirs = things()
- >>> files = things()
- >>> [ dirs.heading(c, text=c.capitalize()) for c in dirCols]
- ('foo',) {'text': 'Foo'}
- ('bar',) {'text': 'Bar'}
- ('baz',) {'text': 'Baz'}
- [None, None, None]
- >>> [files.heading(c, text=c.capitalize()) for c in fileCols]
- ('spam',) {'text': 'Spam'}
- ('ham',) {'text': 'Ham'}
- ('egg',) {'text': 'Egg'}
- [None, None, None]
- >>>