At least Java® prohibits two fields with the same name.Yorick Maloy wrote: . . . even though it doesn't work . . .
You mean some IDEs have a default setting to warn you of a potential mistake. I think Sun shouldn't have allowed us to call static fields by an object reference, because that can cause insidious and obscure errors. But they did, and we are stuck with it.in Java we can access static fields using "this" as well, but at least IDE complains).
Don't think about fields being used statically or not. Think about fields belonging to the object, and static fields as the exception, which requires a good explanation.So, if the field is not used statically, then there is no point of declaring it as such in a first place. . . .
Yorick Maloy wrote:'m quite new to Python and I was wondering - how to improve readability of fields in classes?
Campbell Ritchie wrote: Don't do arithmetic with Math#random(). For everything except a double x such that 0.0 ≤ x < 1.0, use a Random object. By the way, your arithmetic won't compile because its result is a double not an int.
that was more of a lucky copy-pasteYou got used to randrange()
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Tim Holloway wrote:...Python assumes you're working with a name in global or local scope. If you're lucky, it will complain about it.
...
I've been burned by failure to explicitly include "self" in expressions (and method declarations) more times than I can possibly count.