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

2016-11-17 Thread Boylan, Ross
, I agree there are reasons to use repr inside a list. Ross From: Python-list [python-list-bounces+ross.boylan=ucsf@python.org] on behalf of Ethan Furman [et...@stoneleaf.us] Sent: Thursday, November 17, 2016 4:18 PM To: python-list@python.org Subject: Re

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

2016-11-17 Thread Ethan Furman
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 context, namely formatting something for display or looking f

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

2016-11-17 Thread Ned Batchelder
On Thursday, November 17, 2016 at 6:50:07 PM UTC-5, 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 context, > namely formatting something for display or looking f

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

2016-11-17 Thread MRAB
16 3:24 PM 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 wrote: 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

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

2016-11-17 Thread Boylan, Ross
24 PM 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 wrote: > Even after defining custom __str__ and __format__ methods they don't affect > the display of objects when they are in a list. I

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

2016-11-17 Thread Chris Angelico
On Fri, Nov 18, 2016 at 10:04 AM, Boylan, Ross wrote: > 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? > Yep! Inside a