
On Thu, Sep 7, 2017 at 3:49 PM, Larry Hastings <larry@hastings.org> wrote:
But I can cite at least one place in the standard library that would have been better if it'd been implemented as a module property:
os.stat_float_times().
I wish there were a property feature available almost very time I encounter a "get*" method in the stdlib (or any where): There are a heck of a lot in the os module: In [4]: [s for s in dir(os) if s.startswith('get')] Out[4]: ['get_blocking', 'get_exec_path', 'get_inheritable', 'get_terminal_size', 'getcwd', 'getcwdb', 'getegid', 'getenv', 'getenvb', 'geteuid', 'getgid', 'getgrouplist', 'getgroups', 'getloadavg', 'getlogin', 'getpgid', 'getpgrp', 'getpid', 'getppid', 'getpriority', 'getsid', 'getuid'] Many of those may be good use-cases for getters, but still... And just yesterday I was getting annoyed by some in sysconfig: In [6]: [s for s in dir(sysconfig) if s.startswith('get')] Out[6]: ['get_config_h_filename', 'get_config_var', 'get_config_vars', 'get_makefile_filename', 'get_path', 'get_path_names', 'get_paths', 'get_platform', 'get_python_version', 'get_scheme_names'] modules serve the very useful function of a global singleton -- if we think properties are a good idea for classes, then they are a good idea for modules... -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov