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

[Proposal] Add __setattr__ to Wrapper baseclass #2952

Closed
1 task done
seawee1 opened this issue Jul 6, 2022 · 2 comments
Closed
1 task done

[Proposal] Add __setattr__ to Wrapper baseclass #2952

seawee1 opened this issue Jul 6, 2022 · 2 comments

Comments

@seawee1
Copy link

seawee1 commented Jul 6, 2022

Proposal

Currently, I am working with Tianshou which offers an env.set_env_attr(name, value) function. However, when I don't disable all default gym wrappers (OrderEnforcing and PassivEnvChecker as of now), the setattr call issued by Tianshou onto the wrapped environment does not arrive at the actual environment object. Instead, the setattr is processed by the Wrapper object and, as a result, sets the attribute of the outermost wrapper. Do I overlook something?

Motivation

I don't see any clear reason, why this is not implemented correctly.

Pitch

See above.

Alternatives

Leave it as it is, which will lead people to not use your provided environment wrappers.

Additional context

Checklist

  • I have checked that there is no similar issue in the repo (required)
@RedTachyon
Copy link
Contributor

The canonical way of doing this is env.unwrapped.(whatever), which will always bring you to the raw environment. What's the problem with using that?

Overriding __setattr__ in a wrapper would make it impossible to, well, set attributes of the wrapper itself.

@seawee1
Copy link
Author

seawee1 commented Jul 7, 2022

Ah okay, that makes sense. Then this is probably something that might have to be adapted on Tianshou's side. Thanks!

@seawee1 seawee1 closed this as completed Jul 7, 2022
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

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy