Issue3474
Created on 2008-07-31 03:40 by brett.cannon, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| import_from_functools.diff | benjamin.peterson, 2008-08-16 01:41 | |||
| Messages (9) | |||
|---|---|---|---|
| msg70484 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2008-07-31 03:40 | |
It turns out that functools.reduce() is simply __builtins__.reduce(). That does not stop the DeprecationWarning from using reduce() from being raised even though the message says to use functools.reduce()! Easiest solution is to create a wrapper for __builtin__.reduce() that silences the warning when called. |
|||
| msg70486 - (view) | Author: Raymond Hettinger (rhettinger) * ![]() |
Date: 2008-07-31 06:32 | |
Can't this be handled by 2-to-3 instead of a -3 warning? |
|||
| msg70526 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2008-07-31 17:43 | |
On Wed, Jul 30, 2008 at 11:32 PM, Raymond Hettinger <report@bugs.python.org> wrote: > > Raymond Hettinger <rhettinger@users.sourceforge.net> added the comment: > > Can't this be handled by 2-to-3 instead of a -3 warning? > Well, there is the problem of someone having a function already named reduce() and the import. Since 2to3 can't go back and add an import, every found use of reduce() would need to have an import inserted somewhere. That won't work if reduce() is being used in a expression context instead of a statement context, etc. |
|||
| msg70527 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2008-07-31 18:56 | |
Alternatively, you could move reduce to functools and have the builtin module issue a warning and call it. |
|||
| msg70533 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2008-07-31 23:32 | |
On Thu, Jul 31, 2008 at 11:56 AM, Benjamin Peterson <report@bugs.python.org> wrote: > > Benjamin Peterson <musiccomposition@gmail.com> added the comment: > > Alternatively, you could move reduce to functools and have the builtin > module issue a warning and call it. > That's what 3.0 did; created _functools and that holds the original implementation from __builtins__. But that is a lot more work. =) |
|||
| msg71192 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2008-08-16 01:41 | |
Here's a patch that actually imports reduce from functools to stop repetition. |
|||
| msg71309 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2008-08-18 01:52 | |
Reviewing the patch at http://codereview.appspot.com/2968 . |
|||
| msg71310 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2008-08-18 01:57 | |
Reviewed in Rietveld. Only a minor change is suggested. Otherwise I think the patch is ready to be committed, Benjamin. |
|||
| msg71311 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2008-08-18 02:01 | |
Thanks for the review! Committed in r65802. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:37 | admin | set | github: 47724 |
| 2008-08-18 02:01:36 | benjamin.peterson | set | status: open -> closed resolution: fixed messages: + msg71311 |
| 2008-08-18 01:57:31 | brett.cannon | set | assignee: brett.cannon -> benjamin.peterson messages: + msg71310 |
| 2008-08-18 01:52:52 | brett.cannon | set | messages: + msg71309 |
| 2008-08-16 01:41:22 | benjamin.peterson | set | priority: release blocker -> high keywords: + patch messages: + msg71192 files: + import_from_functools.diff |
| 2008-08-03 02:00:25 | brett.cannon | set | priority: critical -> release blocker |
| 2008-07-31 23:33:00 | brett.cannon | set | messages: + msg70533 |
| 2008-07-31 18:56:12 | benjamin.peterson | set | nosy:
+ benjamin.peterson messages: + msg70527 |
| 2008-07-31 17:43:58 | brett.cannon | set | messages: + msg70526 |
| 2008-07-31 06:32:37 | rhettinger | set | nosy:
+ rhettinger messages: + msg70486 components: + 2to3 (2.x to 3.x conversion tool), - Library (Lib) |
| 2008-07-31 03:40:54 | brett.cannon | create | |
