5 ms·
By the way, if anyone is curious what a really terrible constructor looks like: https://github.com/jupyterhub/kubespawner/blob/81e6059a1481138d27d0d3c32f403ecd
by throwaway894345 5y ago
By the way, if anyone is curious what a really terrible constructor looks like:
https://github.com/jupyterhub/kubespawner/blob/81e6059a1481138d27d0d3c32f403ecd21d576d8/kubespawner/spawner.py#L157-L228 https://github.com/jupyterhub/kubespawner/blob/81e6059a14811...
^ I'm also curious to hear from people whether this kind of design is "OOP" or not, or if there are any good terms for talking about this particular antipattern.
- blandflakes 5y agoI'm not really an OOP or Python defender, and generally agree that this type of constructor is inscrutable, frustrating, and quite common in the Python ecosystem. That said, I would not consider default mock values in a constructor to be good OOP. In general, "new"ing things in a constructor IMO is a no-go and makes for harder testing and confusing behavior. At the end of the day I'm not even sure why this class supports mock behavior. I'd expect two separate classes with divorced implementations, instead of an if statement on a boolean param.