Friday Finking: Source code organisation
Tim Chase
python.list at tim.thechases.com
Sat Dec 28 20:19:04 EST 2019
On 2019-12-29 12:52, 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.
>
> I tend to do this too, although it's probably just a habit
> carried over from languages such as Pascal and C where you
> have to go out of your way to get things in a different
> order.
Apparently I'm not alone in my Pascal/C-derived habits of
define-before-use.
Inside a class, I tend to roughly follow
__new__ (if present)
__init__
other dunder methods
subsequent methods alphabetically
-tkc
More information about the Python-list
mailing list