Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support dictproxy views Fixes #295 #309

Conversation

graingert
Copy link
Contributor

No description provided.

@graingert graingert force-pushed the workaround-missing-dictproxy-methods branch from f069cde to 1281710 Compare November 14, 2019 11:22
test_six.py Outdated Show resolved Hide resolved
@graingert graingert force-pushed the workaround-missing-dictproxy-methods branch 2 times, most recently from 6cbab8a to e0e017d Compare November 14, 2019 11:46
@graingert graingert force-pushed the workaround-missing-dictproxy-methods branch from e0e017d to 6afc04b Compare November 14, 2019 11:50
@graingert graingert changed the title workaround missing dictproxy methods Fixes #295 support dictproxy views Fixes #295 Nov 14, 2019
@graingert
Copy link
Contributor Author

@benjaminp I think this fixes the issues with my previous attempt

@graingert
Copy link
Contributor Author

@benjaminp any thoughts on this?

@graingert
Copy link
Contributor Author

#295

@graingert
Copy link
Contributor Author

@benjaminp any thoughts on this?

@benjaminp
Copy link
Owner

Thank you for the PR. As I said in #296 (comment), I don't want to complicate view* for this, especially since there's no way to view dict proxy's on Python 2.

@benjaminp benjaminp closed this Jan 7, 2020
@graingert
Copy link
Contributor Author

Thank you for the PR. As I said in #296 (comment), I don't want to complicate view* for this, especially since there's no way to view dict proxy's on Python 2.

But it does work for dictproxy, you just use the collections.*View

@benjaminp
Copy link
Owner

Sorry, I meant a method on the type.

@graingert
Copy link
Contributor Author

graingert commented Jan 8, 2020

I'd like you to reconsider, because it makes it much easier to use six.viewitems everywhere it would also be supported in Py3 (eg class Foo(object): ...; six.viewitems(vars(Foo)) and much easier to produce safe automated transforms when upgrading a py2 codebase to py3

@benjaminp
Copy link
Owner

I'd like you to reconsider,

I've already considered it twice.

because it makes it much easier to use six.viewitems everywhere it would also be supported in Py3 (eg class Foo(object): ...; six.viewitems(vars(Foo)) and much easier to produce safe automated transforms when upgrading a py2 codebase to py3

What automated transform? If the Python 2 code is doing something.viewitems(), then it already doesn't work it dict proxies. If it's doing something.iteritems(), six.iteritems(something) will work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants