Message71355
| Author |
brett.cannon |
| Recipients |
brett.cannon, collinwinter, nedds, rhettinger |
| Date |
2008年08月18日.18:07:30 |
| SpamBayes Score |
4.715124e-09 |
| Marked as misclassified |
No |
| Message-id |
<bbaeab100808181107j2510ca80s13864de363d6dea1@mail.gmail.com> |
| In-reply-to |
<1219082366.79.0.519552647148.issue2876@psf.upfronthosting.co.za> |
| Content |
On Mon, Aug 18, 2008 at 10:59 AM, Nick Edds <report@bugs.python.org> wrote:
>
> Nick Edds <nedds@uchicago.edu> added the comment:
>
> What's the current status of this?
I think it is waiting for someone to work on it.
> If nobody is working on it, I would
> be willing to give it a shot.
Great!
> Can somebody just confirm that I have a
> correct understanding of the problem.
> UserDict.UserDict needs a deprecation warning, UserDict.IterableUserDict
> becomes collections.UserDict, and UserDict.Mixin becomes
> collections.MutableMapping.
In theory, yes, but the superclasses have changed, so I don't know if
having a fixer is really the best option in this case since it is not
a simple renaming. Perhaps deprecation warnings stating that the
classes have been moved and given different superclasses would make
more sense?
> Then for keys(), items(), and values(), I
> want to replace something like d.keys() to list(d.keys()).
Sure, but how the heck are you going to get 2to3 to do this properly
just for UserDict instances? Doesn't the keys()/values()/items() fixer
already do this blindly anyway?
> One added question: based on what I gathered from PEP 3106, this last
> part is only needed in a situation such as a = d.keys(), but not a
> situation like for key in keys:, so because in the later case wrapping
> the call to keys() in list() would presumably be suboptimal, is this
> something I should try and avoid? I'm not sure exactly how it could be
> done, but I have some idea of how it to do it.
>
Yes, you are right that wrapping the call in a for loop is not needed
since code will never come across it. But as I said above, doesn't the
fixer for dicts already handle all of this? |
|