[issue27840] functools.partial: don't copy keywoard arguments in partial_call()?

2017-02-27 Thread Berker Peksag

Berker Peksag added the comment:

PR 253 has been merged.

--
nosy: +berker.peksag
resolution:  -> rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27840] functools.partial: don't copy keywoard arguments in partial_call()?

2017-02-23 Thread STINNER Victor

STINNER Victor added the comment:

I reopen the issue to propose to add a comment explaining why the dictionary 
must always be copied:
https://github.com/python/cpython/pull/253

--
pull_requests: +221
resolution: rejected -> 
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27840] functools.partial: don't copy keywoard arguments in partial_call()?

2016-08-26 Thread Ned Deily

Changes by Ned Deily :


--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27840] functools.partial: don't copy keywoard arguments in partial_call()?

2016-08-26 Thread STINNER Victor

STINNER Victor added the comment:

Ah yes sorry, I misunderstood the link between kwargs from a C function and
a PY function. The link is simple, it's the same object :-) This issue can
be closed.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27840] functools.partial: don't copy keywoard arguments in partial_call()?

2016-08-25 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I concur with Antoine.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27840] functools.partial: don't copy keywoard arguments in partial_call()?

2016-08-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Modifying the keyword arguments dict is quite common so this change would be a 
heavy compatibility breaker.

A well-known idiom:

  def some_function(..., **kwargs):
  some_option = kwargs.pop('some_option', None)
  # further process kwargs

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27840] functools.partial: don't copy keywoard arguments in partial_call()?

2016-08-23 Thread STINNER Victor

New submission from STINNER Victor:

I justed optimized partial_call() for positional arguments in the change 
c1a698edfa1b to avoid the creation of a temporary tuple when possible.

I noticed that keyword parameters from partial() constructor are always copied. 
Is it mandatory? Can't we avoid copying them?

Example:
---
import functools
hello = functools.partial(print, "Hello World", end='!\n')
hello()
---

hello keyword arguments are {'end'; '!\n'}.

Attached patch avoids copying keyword arguments when the partial objects is not 
called with new keyword arguments.

Tests pass, but I don't know if there is a risk that some strange function 
modify keyword arguments in-place?

--
files: partial_call_kwargs.patch
keywords: patch
messages: 273456
nosy: haypo, rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: functools.partial: don't copy keywoard arguments in partial_call()?
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file44199/partial_call_kwargs.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com