A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-October/049624.html below:

[Python-Dev] Re: [Python-checkins] python/dist/src/Pythoncompile.c, 2.330, 2.331

[Python-Dev] Re: [Python-checkins] python/dist/src/Pythoncompile.c, 2.330, 2.331Phillip 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 
> want
> > 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
>clever?

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[0]==l[1]
False
 >>> l[0].func_code is l[1].func_code
True

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 mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4