[Python-Dev] Re: [Python-checkins]
python/dist/src/Pythoncompile.c, 2.330, 2.331
Phillip J. Eby
pje at telecommunity.com
Mon Oct 25 20:12:29 CEST 2004
At 09:36 AM 10/25/04 -0700, Guido van Rossum wrote:
> > I can't think of an application where the current behaviour would be of
> > great benefit. It's always possible to create a tuple of the fields you
> > in the comparison. Unless it caused a drop in performance, I'd be in favour
> > of only having identity comparison for code objects.
>Well, then perhaps code object comparison (and function object
>comparison) ought to work the same as 'is', not try to do something
Isn't that what function objects do now? (for some value of "now")
Python 2.3.4 (#1, Jun 13 2004, 11:21:03)
[GCC 3.3.1 (cygming special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> l = [lambda:None for i in 0,1]
>>> l.func_code is l.func_code
It would seem that two lambdas with no default arguments, no free
variables, and identical code objects would be "equal" if we were using
value comparison, rather than identity.
More information about the Python-Dev