Using namedtuples field names for column indices in a list of lists
Deborah Swanson
python at deborahswanson.net
Mon Jan 9 01:18:35 EST 2017
Steven D'Aprano wrote, on January 07, 2017 10:43 PM
>> On Sunday 08 January 2017 16:39, Deborah Swanson wrote:
>> The recommended way is with the _replace method:
>> py> instance._replace(A=999)
> Record(A=999, B=20, C=30)
> py> instance._replace(A=999, C=888)
> Record(A=999, B=20, C=888)
>> --
> Steven
> "Ever since I learned about confirmation bias, I've been seeing
> it everywhere." - Jon Ronson
instance._replace(A=999) works perfectly, and editting my existing
assignment statements was really easy. Thanks - a lot.
More information about the Python-list
mailing list