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

Resource.get overlaps dict.get method #8

Open
varelaz opened this issue Sep 9, 2015 · 5 comments
Open

Resource.get overlaps dict.get method #8

varelaz opened this issue Sep 9, 2015 · 5 comments

Comments

@varelaz
Copy link

varelaz commented Sep 9, 2015

Since it's not guaranteed that some data presents it seems reasonable to check replies with dict.get method company.get('some_data', 'default').
However it's not possible, because get method is overlapped.
There is exist a workaround: company = dict(company).

@mgilson
Copy link
Contributor

mgilson commented Apr 20, 2016

Another (possibly ugly) workaround is to use the unbound method:

dict.get(company, 'some_data')

This avoids copying the data at least...


I definitely agree that this isn't ideal (though, I speak as a third-party, not for clearbit). I think that a possible solution would be to change the method names:

Resource.GET
Resource.POST
etc.

But that would definitely be a breaking change. I don't know how often those methods are actually called from client code though, so it might not be too bad (I think that usually .find is called which ultimately calls .get)...

@maccman
Copy link
Contributor

maccman commented Apr 20, 2016

Makes sense. I'll figure out a fix for this.

@jonathan-s
Copy link

I would echo this, because I just stumbled upon this gotcha..

@nilehmann
Copy link

any updates on this?

@amitay87
Copy link

amitay87 commented Mar 15, 2019

Check out my branch:
#30
I wrote the functions get_field and dict()

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

No branches or pull requests

6 participants