Issue3417
Created on 2008-07-19 13:51 by benjamin.peterson, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| smarter_fix_dict.diff | benjamin.peterson, 2008-07-19 19:17 | |||
| Messages (12) | |||
|---|---|---|---|
| msg70031 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2008-07-19 13:51 | |
Can we make the part of fix_dict that converts d.items/values/keys to list(d.items) explicit? Most of the time, it's fine if the method returns a view and can be a bit of a performance hit to convert it to a list. |
|||
| msg70035 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2008-07-19 14:03 | |
Rather, the list of special contexts in which it is ok to not use list() should be extended. |
|||
| msg70036 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2008-07-19 14:08 | |
Exactly! For example, if the .items call is in a for loop, list() doesn't need to be called. |
|||
| msg70051 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2008-07-19 19:17 | |
Here's a patch that doesn't add the enclosing list call in a for loop. |
|||
| msg70052 - (view) | Author: Raymond Hettinger (rhettinger) * ![]() |
Date: 2008-07-19 19:58 | |
for k in d.keys(): return k # needs to return a list |
|||
| msg70095 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2008-07-20 22:38 | |
>for k in d.keys(): > return k # needs to return a list Could you explain this a bit more? |
|||
| msg70097 - (view) | Author: Raymond Hettinger (rhettinger) * ![]() |
Date: 2008-07-21 02:44 | |
The example was mucked-up :( The question is that when for-looping over d.keys/items etc, how you know that the body of the loop isn't going to mutate the dict? |
|||
| msg70134 - (view) | Author: Collin Winter (collinwinter) * ![]() |
Date: 2008-07-22 04:04 | |
I think the proper way to address this is via the confidence levels that Rodrigo Bernardo Pimentel is adding for his Summer of Code project. The idea is that you'll be able to say "let me inspect any changes where the fixer is less than X% confident". fix_dict and for loops would be one such place. Until that mechanism is in place, I agree with Raymond that we should err on the side of correctness. |
|||
| msg70145 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2008-07-22 12:32 | |
Ok. I'll mark this as something to do for 2.7/3.1. |
|||
| msg72602 - (view) | Author: Rodrigo Bernardo Pimentel (rbp) ![]() |
Date: 2008-09-05 15:50 | |
I haven't managed to successfully complete the summer of code, due to some personal problems, but I'm still working on 2to3 and on confidence ranking for it. There's a bzr branch with its current implementation at http://isnomore.net/bzr/2to3 . I did an initial implementation of confidence penalties on fix_dict for special contexts. I'm still working on it (and on confidence ranking in general), but please take a look and let me know what you think. |
|||
| msg72739 - (view) | Author: Rodrigo Bernardo Pimentel (rbp) ![]() |
Date: 2008-09-07 15:03 | |
(I've just realized it's not working properly for fix_dict; I'm fixing it and will drop a note here when it is) |
|||
| msg114603 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2010-08-21 23:11 | |
Is this still relevant? |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:36 | admin | set | github: 47667 |
| 2010-08-21 23:32:53 | benjamin.peterson | set | status: open -> closed |
| 2010-08-21 23:14:32 | benjamin.peterson | set | resolution: wont fix |
| 2010-08-21 23:13:43 | eric.araujo | set | nosy:
+ eric.araujo |
| 2010-08-21 23:11:07 | georg.brandl | set | messages: + msg114603 |
| 2008-09-07 15:03:10 | rbp | set | messages: + msg72739 |
| 2008-09-05 15:50:46 | rbp | set | messages: + msg72602 |
| 2008-07-22 12:32:28 | benjamin.peterson | set | messages:
+ msg70145 versions: + Python 3.1, Python 2.7 |
| 2008-07-22 04:04:38 | collinwinter | set | nosy:
+ rbp messages: + msg70134 |
| 2008-07-21 02:44:14 | rhettinger | set | messages: + msg70097 |
| 2008-07-20 22:38:40 | benjamin.peterson | set | messages: + msg70095 |
| 2008-07-19 19:58:58 | rhettinger | set | nosy:
+ rhettinger messages: + msg70052 |
| 2008-07-19 19:17:07 | benjamin.peterson | set | files:
+ smarter_fix_dict.diff keywords: + patch messages: + msg70051 |
| 2008-07-19 14:08:16 | benjamin.peterson | set | messages:
+ msg70036 title: make the fix_dict fixer explicit -> make the fix_dict fixer smarter |
| 2008-07-19 14:03:24 | georg.brandl | set | nosy:
+ georg.brandl messages: + msg70035 |
| 2008-07-19 13:51:59 | benjamin.peterson | create | |
