error in syntax description for comprehensions?

2017-03-30 Thread Boylan, Ross
https://docs.python.org/3/reference/expressions.html#displays-for-lists-sets-and-dictionaries describes the syntax for comprehensions as comprehension ::= expression comp_for comp_for ::= [ASYNC] "for" target_list "in" or_test [comp_iter] comp_iter ::= comp_for | comp_if comp_if

RE: how to control formatting of a namedtuple in a list

2016-11-17 Thread Boylan, Ross
medtuple in a list On 11/17/2016 04:09 PM, MRAB wrote: > On 2016-11-17 23:49, Boylan, Ross wrote: >> Thank you; I can confirm that overriding __repr__ makes the list display as >> I wanted. >> >> The decision to use repr inside the list seems very odd, given the

RE: how to control formatting of a namedtuple in a list

2016-11-17 Thread Boylan, Ross
To: python-list@python.org Subject: Re: how to control formatting of a namedtuple in a list On Fri, Nov 18, 2016 at 10:04 AM, Boylan, Ross <ross.boy...@ucsf.edu> wrote: > Even after defining custom __str__ and __format__ methods they don't affect > the display of objects when they a

how to control formatting of a namedtuple in a list

2016-11-17 Thread Boylan, Ross
Even after defining custom __str__ and __format__ methods they don't affect the display of objects when they are in a list. Is there a way to change that, other than explicitly converting each list element to a string? The last line of output below shows that when I format the list I get