[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Handy utilities = Friday Filosofical Finking

On 2019-03-28, DL Neil <PythonList at> wrote:
> How do you keep, use, and maintain those handy snippets,
> functions, classes... - units of code, which you employ
> over-and-over again?
> Having coded 'stuff' once, most of us will keep units of code,
> "utilities", which we expect will be useful in-future (DRY
> principle), eg functions to rename files, choose unique
> back-up/new fileNMs, accessing a DB, journalling (logging)
> start/stop msgs, building specs from YAML/JSON/XML/.ini config
> files (tongue~cheek), etc.
> Do you 'keep' these, or perhaps next time you need something
> you've 'done before' do you remember when/where a technique was
> last used/burrow into 'history'? (else, code it from scratch,
> all over again)

I usually wait until I notice I've written or wanted the same
code snippet many times before I'll make it into a library.

> How do you keep them updated, ie if add some new idea, better
> err-checking, re-factor - how to add these 'back' into previous
> places utility is used? (who wants more "technical debt", plus
> handling classic update/versioning issue)

After the library is written back-porting it to other place where
it will be useful is done slowly over time as those utilities
need updating for other reasons.

> How do you keep these? eg special file/dir, within IDE, leave
> in app and 'remember', on paper, ... If the former, how do you
> access/import them from the various applications/systems?
> (Python's import rules and restrictions, change control/version
> control)

I have a lib directory in my PYTHONPATH to dump 'em.

Neil Cerutti