Skip to content

Conversation

@Mahi
Copy link
Contributor

@Mahi Mahi commented Dec 3, 2015

No description provided.

Mahi added 2 commits December 3, 2015 03:54
Since BaseEntity's __setattr__ does nothing necessary for these calls,
I've changed all the super().__setattr__() calls to object.__setattr__()
to skip all the nonsense.
@Mahi Mahi changed the title Updated entities to use super().__setattr__ Updated entities to use object.__setattr__() Dec 3, 2015
@Ayuto
Copy link
Member

Ayuto commented Dec 5, 2015

I'm not sure if we really want to use object.setattr instead of using super(), but I will merge it for now. Thanks for the PR!

Ayuto added a commit that referenced this pull request Dec 5, 2015
Updated entities to use object.__setattr__(). Fixed issue #89.
@Ayuto Ayuto merged commit e4565a6 into Source-Python-Dev-Team:master Dec 5, 2015
@Mahi Mahi deleted the setattr-update branch December 5, 2015 12:07
@Mahi
Copy link
Contributor Author

Mahi commented Dec 5, 2015

Yup, that's up to you guys how you eventually to be done. I find it better (explicit is better than implicit!) and clearer, but that's just me and I'm happy with any fix at all, so thanks for the merge!

@satoon101
Copy link
Member

I get the explicit/implicit argument, but I have always read that you should use super in case of a change in inheritance. I understand that that really wouldn't be an issue in this instance, but I would prefer to remain consistent with this.

@Mahi
Copy link
Contributor Author

Mahi commented Dec 6, 2015

I get the explicit/implicit argument, but I have always read that you should use super in case of a change in inheritance.

As far as I'm aware, this simply means that if you don't know how to set the attribute, ask your base class to set it. However, since you were already explicitly skipping the base class to get to object.__setattr__ (using super(Entity, self) in Player class instead of super(Player, self)), I think that negatiates the whole idea of using super() so it's just better to explicitly use object.__settattr__. This is not true inside of the Entity class since you're not skipping anything, but even in Entity you'd probably skip the base class if it had any weird logic in its __setattr__ to get straight to the object.__setattr__. I could be wrong though, but that's how I see it, you obviously make the final decision.

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