Op 25-11-15 om 01:36 schreef Steven D'Aprano: > On Wed, 25 Nov 2015 08:25 am, Antoon Pardon wrote: > >> The point is that a >> tuple can just be loaded as a constant without needing something extra. > > How would one load this tuple as a constant? > > (myfile.read(), "%.5f" % sin(x or y))
Picking nits again. That respons was done in a context fo what I called literals. Do you expect me to summarize the context in each response? > The point is that *in general*, tuple so-called "literals" (what the docs > call displays) cannot be loaded as constants. If, and only if, the tuple > contains nothing but immutable constants e.g. > > (1, 2.0, None, "spam") > > then a sufficiently smart compiler may be able to treat that specific tuple > as a constant/literal. But that's a special case, and cannot be generalised > to all tuple displays. > > All tuple so-called "literals" e.g. (), (1, 2), (x, y, z) etc. are > fundamentally expressions that *may* have to be built at runtime. Hence the > word "literal" is inappropriate. Literals are constants. So (x, y, z) is not a literal. This is what wikipedia says: In computer science, a literal is a notation for representing a fixed value in source code. Since (x, y, z) is not a fixed value, it is not a literal. -- Antoon. -- https://mail.python.org/mailman/listinfo/python-list