Re: Common objects for CLI commands with Typer

Liste des GroupesRevenir à cl python 
Sujet : Re: Common objects for CLI commands with Typer
De : roland.em0001 (at) *nospam* googlemail.com (Roland Müller)
Groupes : comp.lang.python
Date : 16. Oct 2024, 20:32:32
Autres entêtes
Message-ID : <mailman.27.1729103559.4695.python-list@python.org>
References : 1 2 3 4 5 6
User-Agent : Mozilla Thunderbird
On 9/23/24 22:51, Dan Sommers via Python-list wrote:
On 2024-09-23 at 19:00:10 +0100,
Barry Scott <barry@barrys-emacs.org> wrote:
>
On 21 Sep 2024, at 11:40, Dan Sommers via Python-list <python-list@python.org> wrote:
But once your code gets big the disciple of using classes helps
maintenance. Code with lots of globals is problematic.
Even before your code gets big, discipline helps maintenance.  :-)
>
Every level of your program has globals.  An application with too many
classes is no better (or worse) than a class with too many methods, or a
module with too many functions.  Insert your own definitions of (and
tolerances for) "too many," which will vary in flexibility.
>
I think the need of classes comes when you need objects thus a set of variables with an identity and that may be created N times. Classes are object factories.
A second aspect is inheritance: classes may inherit from other classes and reuse existing functionality and data structures for their objects.
In cases where you only need to encapsulate a single set of data and functions modules are the best choice.

Date Sujet#  Auteur
20 Sep 24 * Common objects for CLI commands with Typer7Loris Bennett
20 Sep 24 +- Re: Common objects for CLI (Posting On Python-List Prohibited)1Lawrence D'Oliveiro
21 Sep 24 +- Re: Common objects for CLI commands with Typer1Barry
21 Sep 24 +- Re: Common objects for CLI commands with Typer12QdxY4RzWzUUiLuE
23 Sep 24 +- Re: Common objects for CLI commands with Typer1Barry Scott
23 Sep 24 +- Re: Common objects for CLI commands with Typer12QdxY4RzWzUUiLuE
16 Oct 24 `- Re: Common objects for CLI commands with Typer1Roland Müller

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal