← Back to context Comment by pypyguy 15 years ago Any genius willing to translate this to python? 5 comments pypyguy Reply sstrudeau 15 years ago There's a python implementation in the original article: def calculate_score(votes, item_hour_age, gravity=1.8): return (votes - 1) / pow((item_hour_age+2), gravity) zackattack 15 years ago I would prefer PHP but seconded sstrudeau 15 years ago This is pretty trivial but sure, something like: function calculate_score($votes, $item_hour_age, $gravity=1.8) { return ($votes - 1) / pow(($item_hour_age+2), $gravity); } mkramlich 15 years ago it's interested to see such a direction comparison of PHP to Python. PHP is very similar to the Python except with more syntax noise. :) And probably worse docs. And worse namespacing, etc. ;) 1 reply →
sstrudeau 15 years ago There's a python implementation in the original article: def calculate_score(votes, item_hour_age, gravity=1.8): return (votes - 1) / pow((item_hour_age+2), gravity)
zackattack 15 years ago I would prefer PHP but seconded sstrudeau 15 years ago This is pretty trivial but sure, something like: function calculate_score($votes, $item_hour_age, $gravity=1.8) { return ($votes - 1) / pow(($item_hour_age+2), $gravity); } mkramlich 15 years ago it's interested to see such a direction comparison of PHP to Python. PHP is very similar to the Python except with more syntax noise. :) And probably worse docs. And worse namespacing, etc. ;) 1 reply →
sstrudeau 15 years ago This is pretty trivial but sure, something like: function calculate_score($votes, $item_hour_age, $gravity=1.8) { return ($votes - 1) / pow(($item_hour_age+2), $gravity); } mkramlich 15 years ago it's interested to see such a direction comparison of PHP to Python. PHP is very similar to the Python except with more syntax noise. :) And probably worse docs. And worse namespacing, etc. ;) 1 reply →
mkramlich 15 years ago it's interested to see such a direction comparison of PHP to Python. PHP is very similar to the Python except with more syntax noise. :) And probably worse docs. And worse namespacing, etc. ;) 1 reply →
There's a python implementation in the original article:
I would prefer PHP but seconded
This is pretty trivial but sure, something like:
it's interested to see such a direction comparison of PHP to Python. PHP is very similar to the Python except with more syntax noise. :) And probably worse docs. And worse namespacing, etc. ;)
1 reply →