graphkit icon indicating copy to clipboard operation
graphkit copied to clipboard

Replace compose class with compose function in functional.py

Open quipa opened this issue 7 years ago • 1 comments

It seems compose class could be converted to a function and use the initialization arguments as named arguments for the function instead.

Also the class name does not follow the default PEP 8 class naming CapWords convention (although PEP 8 does accept classes that are mainly used as callables to use the function naming convention). For regular Python users this can be confusing.

quipa avatar Jun 09 '18 17:06 quipa

That architectural change would require some effort, instead of overriding __call__, to a function returning a function (i.e. if we were to preserve API).
The current situation [edit: is akin to the "builder pattern" which is a nice UAPI UX, and ] the implementation is not PEP-8 invalid, as you wrote. So what would be the benefit of a functional, function factory?

ankostis avatar Sep 29 '19 21:09 ankostis