Nick Coghlan added the comment:
Indeed, added to __all__ in http://hg.python.org/cpython/rev/ac1685661b07
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4331
___
Roundup Robot added the comment:
New changeset 46d3c5539981 by Nick Coghlan in branch 'default':
Issue #4331: Added functools.partialmethod
http://hg.python.org/cpython/rev/46d3c5539981
--
nosy: +python-dev
___
Python tracker rep...@bugs.python.org
Changes by Nick Coghlan ncogh...@gmail.com:
--
resolution: - fixed
stage: commit review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4331
___
Vajrasky Kok added the comment:
Should we add partialmethod to __all__ for consistency?
--
nosy: +vajrasky
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4331
___
Changes by Nick Coghlan ncogh...@gmail.com:
--
stage: needs patch - commit review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4331
___
___
Changes by Matt Joiner anacro...@gmail.com:
--
nosy: -anacrolix
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4331
___
___
Python-bugs-list
Nick Coghlan added the comment:
Updated patch based on Alon's last patch.
The major functional change is to ensure __self__ is set appropriately on any
bound methods returned by the descriptor.
I also updated the docs and docstring, and added a What's New entry (as well as
rewording the
Changes by Nick Coghlan ncogh...@gmail.com:
--
assignee: - ncoghlan
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4331
___
___
Python-bugs-list
alon horev added the comment:
I've changed the test according to the code review. Thanks
--
Added file: http://bugs.python.org/file32409/4331.v2.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4331
alon horev added the comment:
Adding a patch with tests and documentation. Please feel free to comment on
anything: my English, coding/testing style.
I'm pretty sure the documentation can be better but it turns out I speak better
Python than English.
Two decisions I've made and unsure of:
alon horev added the comment:
I think the following test demonstrates the API we're looking for.
1. Am I missing any functionality?
2. How does partialmethod relate to @absolutemethod?
from functools import partial
class partialmethod(object):
def __init__(self, func, *args, **keywords):
Nick Coghlan added the comment:
On 27 Oct 2013 22:17, alon horev rep...@bugs.python.org wrote:
alon horev added the comment:
I think the following test demonstrates the API we're looking for.
1. Am I missing any functionality?
The keyword arg handling is backwards for unbound methods (the
alon horev added the comment:
Here's another attempt at a consistent api with regular methods.
I'm contemplating whether partialmethod should support __call__. Given the fact
partial is used to bind positional arguments, it will do the 'wrong' thing when
calling the partialmethod directly and
Nick Coghlan added the comment:
I like your suggestion of not providing __call__(), as I don't see a way to
make it work with arbitrary underlying descriptors, and neither classmethod nor
staticmethod is callable.
In terms of usage, I think this approach will be OK, as in practice I expect
alon horev added the comment:
I just want to make sure I understand the semantics concerning class methods,
the following example demonstrates a usage similar to regular methods as much
as possible:
class A(object):
def add(self, x, y):
print(self)
return x + y
add10 =
Nick Coghlan added the comment:
On 26 Oct 2013 05:28, alon horev rep...@bugs.python.org wrote:
Is the first option what you had in mind?
That's actually an interesting question. I was going to say yes, but then I
realised it would be better to just do the right thing when the
underlying object
Nick Coghlan added the comment:
To clarify the current state of this:
- I'm still in favour of adding this feature for Python 3.4
- a suitable patch is still needed, as the currently attached patches modify
the existing functools.partial object, rather than adding a separate
partialmethod API
Nick Coghlan added the comment:
Any associated tests may also want check that wrapping classmethod around a
partialmethod generates a well behaved class method, and ditto for property.
If singledispath, classmethod, partialmethod and class and instance attribute
access all work correctly,
Matt Joiner added the comment:
This sounds excellent Nick.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4331
___
___
Python-bugs-list mailing
Nick Coghlan added the comment:
I don't believe it is reasonable to change the behaviour of partial at this
late stage of the game. It's documented as behaving like staticmethod (albeit
by not implementing the descriptor protocol at all), so that's no longer
something we can change. If issue
20 matches
Mail list logo