[issue829370] math.signum(int)

Frank Breitling report at bugs.python.org
Thu Mar 15 16:56:28 CET 2012


Frank Breitling <frank.breitling at gmx.de> added the comment:

Unfortunately my reply to the list lost all quotes, so I try to answer again through the web interface:
---

> I'm not quite sure why that formula would be "elegant" in the first place,

Because its short.

> and I most certainly don't understand why 0.5*sign((100*YY)+MM-190002.5) + 0.5 is more elegant ...

Because the former is a proper mathematical expression, while the latter is python jargon with limited use elsewhere.

> or rather: implementing leap years correctly in the first place, so the formula also works outside of the 1800-2099 range.

Exactly, why is there no correct implementation of Julian date in python time or datetime?
For most practical purposes I can understand why most people would consider the above formula most useful and most elegant.

> And, in general, I don't understand the problem. Everyone who does scientific computing has numpy *anyway*, so there is no gain for them.

Then what's the math module good for?

> As a last note, the C math.h also doesn't have a sign() function, and only a copysign() function: http://en.wikipedia.org/wiki/C_mathematical_functions

So what? Is this the law of Moses? Or should we fall back to Assebmly?
Python is supposed to be a high-level language not a stone age tool.

However, I am glad you found at least another reason convincing to have this function.

Cheers!

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue829370>
_______________________________________


More information about the Python-bugs-list mailing list