Why Is The property Decorator Only Defined For Classes?
tl;dr: How come property decorators work with class-level function definitions, but not with module-level definitions? I was applying property decorators to some module-level functions, thinking they would allow me to invoke the methods by mere attribute lookup. This was particularly tempting because I was defining a set of configuration functions, like get_port , get_hostname , etc., all of which could have been replaced with their simpler, more terse property counterparts: port , hostname , etc. Thus, config.get_port() would just be the much nicer config.port I was surprised when I found the