Merge pull request #327 from ZapAnton/float_doc

Float type: Added __doc__
This commit is contained in:
Windel Bouwman authored and GitHub committed 2019-02-07 21:08:42 +01:00
commit 385fb03d7a
1 file changed
+8
+8
View File
@@ -268,6 +268,9 @@ fn float_pow(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
pub fn init(context: &PyContext) {
let float_type = &context.float_type;
let float_doc = "Convert a string or number to a floating point number, if possible.";
context.set_attr(&float_type, "__eq__", context.new_rustfunc(float_eq));
context.set_attr(&float_type, "__lt__", context.new_rustfunc(float_lt));
context.set_attr(&float_type, "__le__", context.new_rustfunc(float_le));
@@ -291,4 +294,9 @@ pub fn init(context: &PyContext) {
context.set_attr(&float_type, "__pow__", context.new_rustfunc(float_pow));
context.set_attr(&float_type, "__sub__", context.new_rustfunc(float_sub));
context.set_attr(&float_type, "__repr__", context.new_rustfunc(float_repr));
context.set_attr(
&float_type,
"__doc__",
context.new_str(float_doc.to_string()),
);
}