-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add enum value iteration example #8599
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
Conversation
|
I think you can put your example code snippet directly inside the codeblock above. It's showing how one can use named enum like a dictionary, iterating is one of the operations. |
|
I applied all suggested changes (github having built-in batch for suggestions is quite the feature addition) If you want me to lessen it down (because right now there may be redundance), give the suggestion and I will apply it |
|
Can apply it as a more global suggestion soon, but you should also squash your commits before this can be merged, see here |
AThousandShips
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just need a squash and it looks good
|
First time I squash succesfully. Also changed |
|
You need to rebase your branch, when squashing you accidentally rewound your branch because you hadn't updated your local fork, please do Also I'd say the naming doesn't matter, leave it as |
|
I apologize for my newbieness. I understand that if someone else did this 2 minute pull request it would be done, so I apologize in advance. At least from this I hope I learn how to rebase for future commits. =====
^With either of the above, if I And then I input |
|
And if you do If you can't figure it out I can fix your branch for you |
I think it worked out. Do confirm I didn't mess up the history 😅 |
|
Use |
| # Use constant dictionary functions | ||
| # prints '["STATE_IDLE", "STATE_JUMP", "STATE_SHOOT"]' | ||
| print(State.keys()) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I restore the whitespace here? If yes, should I place it between the below print statements so they aren't a united codeblock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put it after the last line of code, keep two lines before "Functions", easier to read
|
Above commit should be good. That said, I apologize for taking so much of your precious time on such a simple/frequent task 😓 |
|
Thank you for bearing with the review 🙂 looks great! |
|
Indeed, thanks for being accomodating and doing all the work (and for taking your time to contribute in the first place!). And don't worry, we all have to learn some time, no one knows everything. Always feel welcome to ask for help in the comments or in the #documentation channel in contributors chat. Thank you! And thanks for reviewing ATS :) |
| # prints '["STATE_IDLE", "STATE_JUMP", "STATE_SHOOT"]' | ||
| print(State) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait...
This is not true. State is a Dictionary so it should print { "STATE_IDLE": 0, "STATE_JUMP": 5, "STATE_SHOOT": 6 }. Or it should be print(State.keys()) instead.
|
Cherry-picked to 4.2. |
Solves a misunderstanding of iterating enums