You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_foo: this is just a convention, a way for the programmer to indicate that the variable is private.
__foo: this has real meaning: the interpreter replaces this name with _classname__foo as a way to ensure that the name will not overlap with a similar name in another class.
Use clear variables names. Example: what is gen? What for i in gen is meaning?
Don't use i in a for loop if it's not an index.
for name in names is ok
for i, name in enumerate(names) is ok
Comments focus on the why more than the waht. Ex: pluralize doc string. + no need to type function + type doctring.
Declare your attributes in the constructor intead of in __initialize_game it makes think clearer. Then you just need to re-define the values in __initialize_game.
Why do you define a getter for the errors while not doing it for the rest? Try to stay consistant.
Code review
You did well
Can can improve
Repo
srcfolder to divide 'configs' and repo-related files from the code.for example:Code
No need to specify that
__init__()is a constructor, try to avoid obvious comments to keep the code clean.Bad usage of
__to make attributes/methods private. Read more about it here remember that:_foo: this is just a convention, a way for the programmer to indicate that the variable is private.__foo: this has real meaning: the interpreter replaces this name with_classname__fooas a way to ensure that the name will not overlap with a similar name in another class.Use clear variables names. Example: what is
gen? Whatfor i in genis meaning?Don't use
iin a for loop if it's not an index.for name in namesis okfor i, name in enumerate(names)is okComments focus on the why more than the waht. Ex:
pluralizedoc string. + no need to type function + type doctring.Declare your attributes in the constructor intead of in
__initialize_gameit makes think clearer. Then you just need to re-define the values in__initialize_game.Why do you define a getter for the errors while not doing it for the rest? Try to stay consistant.
You can use "\n" in prints to do line breaks.