This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients fkbreitl, gekonntde, mark.dickinson, rhettinger, valhallasw
Date 2012-03-13.19:44:35
SpamBayes Score 0.00032220825
Marked as misclassified No
Message-id <1331667876.16.0.596359387873.issue829370@psf.upfronthosting.co.za>
In-reply-to
Content
I disagree that this is useful enough to make it worth adding to the standard library.  Between math.copysign and simple comparisons, I think all the common cases are well covered.  And it's a simple one-line function:

def signum(x):
    return (x > 0) - (x < 0)

Frank, do you have any convincing use-cases that aren't already covered by math.copysign or simple two-way comparisons (e.g., x >= 0)?
History
Date User Action Args
2012-03-13 19:44:36mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, gekonntde, valhallasw, fkbreitl
2012-03-13 19:44:36mark.dickinsonsetmessageid: <1331667876.16.0.596359387873.issue829370@psf.upfronthosting.co.za>
2012-03-13 19:44:35mark.dickinsonlinkissue829370 messages
2012-03-13 19:44:35mark.dickinsoncreate