[New-bugs-announce] [issue3564] making partial functions comparable

Erick Tryzelaar report at bugs.python.org
Sat Aug 16 09:05:11 CEST 2008

New submission from Erick Tryzelaar <idadesub at users.sourceforge.net>:

functools.partial functions are not comparable, in both python 2.5 and 

>>> def foo(): pass
>>> functools.partial(foo) == functools.partial(foo)

It can be worked around by comparing the func, args, and keywords, but 
this means that if a partial function is stored in some structure, such 

>>> def foo(): pass
>>> f1=functools.partial(foo)
>>> f2=functools.partial(foo)
>>> (1,'a',f1) == (1,'a',f2)

Which complicates things when I'm comparing things in a function that 
works with generic data structures. Would it be possible to extend 
partial to support comparisons?

components: Library (Lib)
messages: 71200
nosy: erickt
severity: normal
status: open
title: making partial functions comparable
type: feature request
versions: Python 2.5, Python 3.0

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list