Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #87895
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: module attributes and docstrings |
| Date | 2015-03-24 15:33 -0400 |
| References | <fg92halkvjecqedpogsmkov3o53f0i922b@4ax.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.110.1427225646.10327.python-list@python.org> (permalink) |
On 3/24/2015 4:55 AM, Mario Figueiredo wrote: > Reading PEP 257 and 258 I got the impression that I could document > module attributes and these would be available in the __doc__ > attribute of the object. > > So things like the one below are something I got used to do, but that > don't work after all, as I learned today: > > value_factory = lambda _, row: row[0] > """Row factory. To be used with single-column queries.""" > > There are other things I could possibly do, like turning that lambda > into a function, You have discovered one of advantages of a def statement over a name=lambda assignment statement. In Python, there is no good reason to use the latter form and PEP 8 specifically discourages it: "Always use a def statement instead of an assignment statement that binds a lambda expression directly to an identifier." -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
module attributes and docstrings Mario Figueiredo <marfig@gmail.com> - 2015-03-24 09:55 +0100
Re: module attributes and docstrings Chris Angelico <rosuav@gmail.com> - 2015-03-24 21:29 +1100
Re: module attributes and docstrings Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-24 22:49 +1100
Re: module attributes and docstrings Mario Figueiredo <marfig@gmail.com> - 2015-03-26 10:48 +0100
Re: module attributes and docstrings Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-27 18:31 +1100
Re: module attributes and docstrings Marko Rauhamaa <marko@pacujo.net> - 2015-03-27 09:49 +0200
Re: module attributes and docstrings Terry Reedy <tjreedy@udel.edu> - 2015-03-24 15:33 -0400
Re: module attributes and docstrings Mario Figueiredo <marfig@gmail.com> - 2015-03-26 10:53 +0100
Re: module attributes and docstrings Chris Angelico <rosuav@gmail.com> - 2015-03-26 21:27 +1100
csiph-web