I'm never certain where to reply in such a case, on the list or on the issue, but since no one is nosy yet to Daniel's patch, I thought I'd ask here.
While a partial object should reasonably never change, you could change it: >>> from functools import partial >>> p = partial(lambda *a, **kw: kw, 1, 2, spam='eggs') >>> p() {'spam': 'eggs'} >>> p.keywords['spam'] = 'bacon' >>> p() {'spam': 'bacon'} >>> I realize touching p.keywords voids your warranty, but if we can stop people from doing it, maybe we should (or at least put a warning in the documentation, no?). So I'm thinking either we make an immutable/hashable dict while we're at it, or store the keyword arguments as a tuple (which guarantees immutability), and only convert them back to a dict when you want to call the partial object (simpler, slower). Your thoughts? Should we continue this discussion at issue8699? - Yaniv On Thu, May 13, 2010 at 1:11 AM, Daniel Urban <urban.d...@gmail.com> wrote: > On Fri, May 7, 2010 at 17:02, Antoine Pitrou <solip...@pitrou.net> wrote: > > It would be more useful to provide equality, hashing and repr to partial > itself, > > rather than a subclass. Feel free to propose a patch :) > > Hi! > > I've done that. > I've opened a feature request: http://bugs.python.org/issue8699 > The patch is also at Rietveld: http://codereview.appspot.com/1179044 > > I'm a beginner, so my patch is probably far from perfect, but I'd > appreciate any help, and will try to correct my mistakes. > > Thanks, > Daniel Urban > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/yaniv%40aknin.name >
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com