why () is () and [] is [] work in other way?

Ian Kelly ian.g.kelly at gmail.com
Thu Apr 26 17:39:37 EDT 2012


On Thu, Apr 26, 2012 at 1:34 PM, Adam Skutt <askutt at gmail.com> wrote:
> What I think you want is what I said above: ValueError raised when
> either operand is a /temporary/ object.  Really, it should probably be
> a parse-time error, since you could (and should) make the
> determination at parse time.

I'm not sure precisely what you mean by "temporary object", so I am
taking it to mean an object that is referenced only by the VM stack
(or something equivalent for other implementations).

In that case: no, you can't.  Take "f() is g()", where the code
objects of f and g are supplied at runtime.  Are the objects returned
by either of those expressions "temporary"?  Without being able to do
static analysis of the code of f and g, there is no way to know.



More information about the Python-list mailing list