When I need classes?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Jan 13 00:27:00 EST 2016


On Wednesday 13 January 2016 14:36, Rustom Mody wrote:

> 1. Python the LANGUAGE, is rather even-handed in paradigm choice: Choose
> OO, imperative, functional or whatever style pleases/suits you
> 2. Python LIBRARIES however need to make committing choices.  Users of
> those then need to align with these.

I don't think that second one is necessarily correct. Look at the random 
module: it is based on an OOP design, with classes random.Random and 
random.SystemRandom doing the real work. But most people don't use them 
directly, they use the procedural interface random.random, random.choice, 
random.seed etc.



-- 
Steve




More information about the Python-list mailing list