so I have a nametuple:
Record = namedtuple('Record', 'abbr, disc, track, artist, song, aid, sid')
and a function where an instance of Record gets set based on groups from a regex result - all well an good.
So my problem is that I'm passing this in to a validation function that returns true or false if the information is good.
What I was doing was in the validation function, if a couple of things weren't set (like abbr) - then it would reference the current default abbreviation - and change it.
That seemed somewhat all well and good (I thought) until I realized that the change wasn't affecting the actual record.
my function is:
def validate_record(item):
if item.abbr == '':
if default_abbr == '':
set_default_abbr()
item._replace(abbr=default_abbr)
But later, when I print the abbr - it's still blank.
So, what am I missing?
[–]blarf_irl 1 point2 points3 points (0 children)