Andrew Barnert wrote: [snip] > But meanwhile, you still haven’t given any reason why Record would be useful. > What > exactly is it supposed to mean? When would you want to check it? What would > you do with an > object only if you know it’s a Record? > This isn’t like checking for a POD type in C++ or a struct type in Swift, > because none > of the important things that tells you even make sense in Python.
The reason I am interested in having it is to disambiguate collections that are primarily to be treated as collections of values from those that are primarily to be accessed as attributes with values. As an example, when converting to JSON, it would make more sense to represent a regular tuple as a JSON array, but it would make more sense to represent a namedtuple as a JSON object. _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/VKMQOFULDOU6NY2LZ5GNAERRU2JYANKR/ Code of Conduct: http://python.org/psf/codeofconduct/
