[Python-ideas] Re: Anonymous namedtuples, revisited

2022-03-26 Thread Michael Green
Agreed w/r/t the issue of typing, glad I wasn't the only one who was feeling that way. Maybe a reasonable approach would be to potentially add this as an option to the collections module? Either as an isolated function (`anamedtuple` perhaps) or add control flow to `namedtuple` such that when o

[Python-ideas] Re: Anonymous namedtuples, revisited

2022-03-24 Thread Michael Green
Well you have the values as they're passed in; just (optionally?) include the type in the signature if you want type differentiation >>> def anamedtuple(**kwargs): ... signature = " ".join([f"{k}: {type(v)}" for k, v in kwargs.items()]) ... _type = anamedtuple.__dict__.get(signatu