Friday Finking: Source code organisation

DL Neil PythonList at DancesWithMice.info
Sat Dec 28 21:43:46 EST 2019


On 29/12/19 2:19 PM, Tim Chase wrote:
> On 2019-12-29 12:52, Greg Ewing wrote:
>> 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.

I didn't expect to be the only one who would bring 'prior experience' 
into it...


> Inside a class, I tend to roughly follow
>    __new__ (if present)
>    __init__
>    other dunder methods
>    subsequent methods alphabetically

+1

Should __new__() and __init__() break with convention because its/their 
method/function signature is (really) part of the class's signature, and 
thus there's a need for proximity?
(aka is "expected")
-- 
Regards =dn


More information about the Python-list mailing list