some tuning

added c++ accept external parameter
tuning python code