Deutsch   English   Français   Italiano  
<mailman.27.1729103559.4695.python-list@python.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!3.eu.feeder.erje.net!feeder.erje.net!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: =?UTF-8?Q?Roland_M=C3=BCller?= <roland.em0001@googlemail.com>
Newsgroups: comp.lang.python
Subject: Re: Common objects for CLI commands with Typer
Date: Wed, 16 Oct 2024 21:32:32 +0300
Lines: 28
Message-ID: <mailman.27.1729103559.4695.python-list@python.org>
References: <87tteayavt.fsf@zedat.fu-berlin.de>
 <28833A4D-B57C-4195-87BF-FAAF9EFF5F19@barrys-emacs.org>
 <Zu6ipTbew8LSHvKG@anomaly>
 <1E3ED29E-161E-430C-9E99-F89266472ADB@barrys-emacs.org>
 <ZvHG1Vzokb0yrUhv@anomaly>
 <aa3149ba-a358-42a6-9e45-f408b745b7a8@googlemail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de /BNGZ7ZpJxPj0peP3iiTvgdnHH0Cdk/wEOlVvHQaxJqg==
Cancel-Lock: sha1:SHu+RBXSpWgB81j1Tj/3+V09/qk= sha256:iDt2zNruFkQTanjwaqCIfanc1zBukYrITpKIfVzzIqo=
Return-Path: <roland.em0001@googlemail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
 reason="2048-bit key; unprotected key"
 header.d=googlemail.com header.i=@googlemail.com header.b=kTNE9vnh;
 dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.005
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'modules': 0.07; ':-)':
 0.09; 'aspect': 0.09; 'choice.': 0.09; 'dan': 0.09;
 'from:addr:googlemail.com': 0.09; 'message-id:@googlemail.com':
 0.09; 'methods,': 0.09; '"too': 0.16; 'barry': 0.16;
 'definitions': 0.16; 'discipline': 0.16; 'flexibility.': 0.16;
 'functions.': 0.16; 'objects.': 0.16; 'received:192.168.100':
 0.16; 'received:mail-lf1-x136.google.com': 0.16; 'reuse': 0.16;
 'structures': 0.16; 'wrote:': 0.16; 'to:addr:python-list': 0.20;
 'code': 0.23; '(and': 0.25; 'classes': 0.26; 'object': 0.26;
 '>>>': 0.28; 'header:User-Agent:1': 0.30; 'module': 0.31;
 'program': 0.31; 'think': 0.32; 'objects': 0.32; 'python-list':
 0.32; 'sep': 0.32; 'but': 0.32; 'subject:for': 0.33; 'header:In-
 Reply-To:1': 0.34; 'received:google.com': 0.34; 'cases': 0.36;
 'functions': 0.36; 'using': 0.37; 'class': 0.37;
 'received:192.168': 0.37; 'single': 0.39; 'helps': 0.60; 'best':
 0.61; 'once': 0.63; 'from:charset:utf-8': 0.64; 'thus': 0.64;
 'times.': 0.64; 'your': 0.64; 'vary': 0.76; 'big,': 0.84;
 'inherit': 0.84; 'scott': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=googlemail.com; s=20230601; t=1729103557; x=1729708357; darn=python.org;
 h=content-transfer-encoding:in-reply-to:from:content-language
 :references:to:subject:user-agent:mime-version:date:message-id:from
 :to:cc:subject:date:message-id:reply-to;
 bh=n+XLvxDrvrl4m9v6q6Y56FC2rI1IzbH8jLzcTVKvyxI=;
 b=kTNE9vnhMiDaaVJusJjcIKiiW2Mw1l6QsSVzy0bV/LgJe3ESnRv0k0anDrKE1aT8mD
 8ryYDoAnoB0Pdy7xHpJsApStikYSO5HxRpQXREf6syVtIDA5e/1RuaAklnJiNpTARS8o
 TW5PTazwB9w4uEiBuOQ/CxFmMnlROyV4tulPMjFs8qWEaLv6Ci+bAFpgBhfY1Pf+E0fF
 lC63ec9W2g1+xZ7Sh88kHNyu8QOszfFRms9ei3XPjFGzM2T/Ep7pJIQnq78n8eiiL3Js
 Zeq2MBpx2IwZpVBqYR34blA5+PRaWormCiW3Vt6HQFcHR+aoBYTmyY6zsK6fioLIJbWw
 IPvA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1729103557; x=1729708357;
 h=content-transfer-encoding:in-reply-to:from:content-language
 :references:to:subject:user-agent:mime-version:date:message-id
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=n+XLvxDrvrl4m9v6q6Y56FC2rI1IzbH8jLzcTVKvyxI=;
 b=Xk0H6r6+pAAgsJpJBtIybcP2bjQKh5EAA1NfdGIn6OiizVeu74kvpyy3WgI6m0zrzr
 rqv9PVSiGeERmlxDJ5mKo7DOkwRNjH+pzrPWpn8AwIei4VWym8uA+mCniO4qnzYpK6w6
 /K1l/V+VRexwoFK2/nbwV3IqaIiwYj6tsdrdeJgD8EGv+GLUEfcnpDgd7GVOOPVSb2jG
 CqzBWwFIKpvQFaP6zp2UQOJjDUketB3EZxxHlq221NS/Zbie1Axp5uDIBa35Qal2J4yS
 csbMJerTvcL2KbghR9RGY0+gKbGSu5aDpmmIbvqCAJEzkankAe7hbedjbon2XfCipd3G
 vqbQ==
X-Gm-Message-State: AOJu0Yyz1Od1iXYkLZhRiygultxZ/xvKG8WJoB08auZmXxDb3t4eMwvu
 Mprv+8AP1BHFbuBl3Gyt8P9Z3+G1espx+43MWz9PQeqMfz91ALEXt7MeDg==
X-Google-Smtp-Source: AGHT+IEoO+EI+vm4f+rm8vspZzUSM61e+5bPp7SXdnLs1C1eL7zvY4J9AunDcxqx6u94EvTjVzLnWw==
X-Received: by 2002:a05:6512:31c2:b0:53a:c16:a9e with SMTP id
 2adb3069b0e04-53a0c160b96mr728407e87.51.1729103557254; 
 Wed, 16 Oct 2024 11:32:37 -0700 (PDT)
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <ZvHG1Vzokb0yrUhv@anomaly>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
 <python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
 <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
 <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <aa3149ba-a358-42a6-9e45-f408b745b7a8@googlemail.com>
X-Mailman-Original-References: <87tteayavt.fsf@zedat.fu-berlin.de>
 <28833A4D-B57C-4195-87BF-FAAF9EFF5F19@barrys-emacs.org>
 <Zu6ipTbew8LSHvKG@anomaly>
 <1E3ED29E-161E-430C-9E99-F89266472ADB@barrys-emacs.org>
 <ZvHG1Vzokb0yrUhv@anomaly>
Bytes: 6519


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.