

Show HN: Varnishtuner.py - jjoe
https://github.com/unixy/varnishtuner.py

======
e12e
Admittedly, I generally write procedural and/or functional python code... but
how is:

    
    
      class CPUInfo(dict):
    	def __init__(self, *args):
    		dict.__init__(self, args)
    
    	def __getitem__(self, key):
    		val = dict.__getitem__(self, key)
    		return val
    
    	def __setitem__(self, key, val):
    		dict.__setitem__(self, key, val)
    

Different from:

    
    
        class CPUInfo(dict):
            pass
    

Doesn't the overrides behave just like dict does?

~~~
bliti
Author probably has future plans for the class. I've seen people write classes
like that to later do overloading. Others write out the methods to sort of
document that those are the ones they are using. I know it might not be one's
cup of tea, but let he who writes perfect code every time push to production
without testing it first.

~~~
e12e
Well, it's nice to see my intuition was right. Seems a little redundant as
documentation - at least for classes in the standard lib. And I'd prefer the
diff from "pass" to "added overloaded method" rather than "changed standard
method". I think.

------
whalesalad
One thing I'd suggest right off the bat is psutil. It looks like y'all did a
lot of manual work to gather basic system information that you'd get out of
the box with psutil. Plus, they've abstracted a lot of the cross-platform
inconsistencies.

~~~
jjoe
Believe me, I did consider it. It'd have made things easier a bit. But the
goal (as stated in Github) is to _not_ depend on any external module.
Execution flow should be to wget && python varnishtuner.py similar to the way
mysqltuner.pl works.

~~~
erikrothoff
Do you have a link to the mysqltuner.pl?

~~~
lmz
[http://mysqltuner.pl](http://mysqltuner.pl) (seriously).

