On 12/28/19 6:52 PM, Greg Ewing wrote: > On 29/12/19 11:49 am, Chris Angelico wrote:
>> "Define before use" is a broad principle that I try to follow, even >> when the code itself doesn't mandate this. > But strangely, I tend to do the opposite for methods of a class. I > don't really know why. My instinctive idea of the "right" ordering > just seems to flip over somehow between modules and classes. Me, too. :-/ Could be one of two reasons: (1) putting the public API at the top and pushing the internal/helper functions towards the bottom (whether program, library, or class); or (2) writing too much FORTRAN and/or BASIC early on, where execution begins at the top, whether you want it to or not Who puts a class's __init__ function anywhere except the very top of a class definition (doc strings and class attributes that aren't "def"ed notwithstanding), even when it calls some other method in the class? Dan -- https://mail.python.org/mailman/listinfo/python-list