Skip to content

Conversation

@Brett55
Copy link

@Brett55 Brett55 commented Mar 19, 2018

I removed a mutable argument (list) as it holds state between function/method calls. This is a latent bug that could be exposed down the road.

return self.client.delete(self._url())

def get(self, id, fields=[], include_fields=True):
def get(self, id, fields=None, include_fields=True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm not a python dev, wanted to understand the potential impact of this?

The default was an empty array, it is now None.
However the first thing you then do is check if fields was None then set it to an empty array. Which was the previous default anyway?

I also noticed other methods use [] for this param and you have not touched those?
https://github.com/Brett55/auth0-python/blob/e300ee2185df0bccd42b77751bda57b90cd7ed3e/auth0/v3/management/users.py#L28

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cocojoe I didn't fix them all, I only fixed the one I saw while using the SDk. This link explains why using a list is bad http://docs.python-guide.org/en/latest/writing/gotchas/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the best practice link. Will review.

Copy link
Contributor

@lbalmaceda lbalmaceda Mar 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only fixed the one I saw while using the SDk

Would be nice if this PR updates every missing lines just like the one @cocojoe linked. Are you willing to update it @Brett55 ?

@Brett55
Copy link
Author

Brett55 commented Mar 23, 2018 via email

@lbalmaceda
Copy link
Contributor

I'm closing this due to inactivity. I've added a new PR solving all the occurrences. Thanks for your contribution.

@lbalmaceda lbalmaceda closed this Jun 19, 2018
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.

3 participants