Re: Common objects for CLI commands with Typer

2024-09-23 Thread Barry Scott via Python-list



> On 21 Sep 2024, at 11:40, Dan Sommers via Python-list 
>  wrote:
> 
> Despite the fact that "everything is an object" in Python, you don't
> have to put data or functions inside classes or objects.  I also know
> nothing about Typer, but there's nothing wrong with functions in a
> module.

Python is great in allowing you to pick your style.
A few lines in a module, a couple of functions or use classes.

But once your code gets big the disciple of using classes helps
maintenance. Code with lots of globals is problematic.

Barry

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Common objects for CLI commands with Typer

2024-09-23 Thread Dan Sommers via Python-list
On 2024-09-23 at 19:00:10 +0100,
Barry Scott  wrote:

> > On 21 Sep 2024, at 11:40, Dan Sommers via Python-list 
> >  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.

(And as was alluded to elsewhere in this thread, you could probably
deduce the original and/or preferred programming languages of people
with certain such definitions.  But I digress.)

$ python -m this|grep Namespaces
Namespaces are one honking great idea -- let's do more of those!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Beazley's Problem

2024-09-23 Thread Annada Behera via Python-list
The "next-level math trick" Newton-Raphson has nothing to do with
functional programming. I have written solvers in purely iterative
style. As far as I know, Newton-Raphson is the opposite of functional
programming as you iteratively solve for the root. Functional programming
is stateless where you are not allowed to store any state (current best
guess root).

-Original Message-
From: Paul Rubin 
Subject: Re: Beazley's Problem
Date: 09/22/2024 01:49:50 AM
Newsgroups: comp.lang.python

r...@zedat.fu-berlin.de (Stefan Ram) writes:
>   It's hella rad to see you bust out those "next-level math tricks"
>   with just a single line each!

You might like:

https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf

The numerics stuff starts on page 9.


-- 
https://mail.python.org/mailman/listinfo/python-list