I have a module with collection:
import collections
named_tuple_sex = collections.namedtuple(
'FlightsResultsSorter',
['TotalPriceASC',
'TransfersASC',
'FlightTimeASC',
'DepartureTimeASC',
'DepartureTimeDESC',
'ArrivalTimeASC',
'ArrivalTimeDESC',
'Airlines']
)
FlightsResultsSorter = named_tuple_sex(
FlightsResultsSorter('TotalPrice', SortOrder.ASC),
FlightsResultsSorter('Transfers', SortOrder.ASC),
FlightsResultsSorter('FlightTime', SortOrder.ASC),
FlightsResultsSorter('DepartureTime', SortOrder.ASC),
FlightsResultsSorter('DepartureTime', SortOrder.DESC),
FlightsResultsSorter('ArrivalTime', SortOrder.ASC),
FlightsResultsSorter('ArrivalTime', SortOrder.DESC),
FlightsResultsSorter('Airlines', SortOrder.ASC)
)
and in another module I iterate by this collection and I want to get name of item:
for x in FlightsResultsSorter:
self.sort(x)
so in upon code I want instead x(which is object) passing for example "DepartureTimeASC" or "ArrivalTimeASC".
How can I get this name ?
Best regards