Op 25-11-15 om 18:40 schreef Steven D'Aprano: > On Wed, 25 Nov 2015 08:56 pm, Antoon Pardon wrote: > >> Since (x, y, z) is not a fixed value, it is not a literal. > > Right. And therefore, (x, y, z) syntax is not syntax for a literal. Hence > why the Python docs call it a tuple display instead of a tuple literal -- > no matter what x, y, z are. Even if they themselves are literals, that's > just a special case that *some* compiler versions may be able to handle. > > You call this "picking nits", but if so, they are nits that are twice the > size of an an elephant and painted bright yellow. Your language arguing > about "tuple literals" seems to be based on the idea that it is usually a > constant and that cases like (x+1, y+2) is some unusual, rare corner > case -- what you call "nits".
I don't know what you are talking about. The first thing I have argued is that () is a literal. Then I have expaned that to that something like (3, 5, 8) is a literal. I never argued that tuple expressions in general are literals. And one way I supported my point was with the following quote from the python language reference. Literals are notations for constant values of some built-in types. And I think that the things I argued were literals, were in fact constant values of some built-in type. > Its not. The most general case is that a > tuple display is an expression which, after evaluation, constructs a tuple. > Those few cases where the compiler can optimize it into a constant are the > nits, not the majority of cases when it can't. The nits, depend on what someone tries to argue. Since I didn't try to argue that tuple displays in general are literals but argued for very specific tuple values to be literals, you starting about tuple displays is going of on a tangent that has little to do with what I was arguing. -- Antoon -- https://mail.python.org/mailman/listinfo/python-list