C# Class Python.Runtime.PyFloat

Represents a Python float object. See the documentation at http://www.python.org/doc/current/api/floatObjects.html
Inheritance: PyNumber
显示文件 Open project: fkarb/pythonnet Class Usage Examples

Public Methods

Method Description
AsFloat ( PyObject value ) : PyFloat

AsFloat Method

Convert a Python object to a Python float if possible, raising a PythonException if the conversion is not possible. This is equivalent to the Python expression "float(object)".

IsFloatType ( PyObject value ) : bool

IsFloatType Method

Returns true if the given object is a Python float.

PyFloat ( IntPtr ptr ) : System

PyFloat Constructor

Creates a new PyFloat from an existing object reference. Note that the instance assumes ownership of the object reference. The object reference is not checked for type-correctness.

PyFloat ( PyObject o ) : System

PyFloat Constructor

Copy constructor - obtain a PyFloat from a generic PyObject. An ArgumentException will be thrown if the given object is not a Python float object.

PyFloat ( double value ) : System

PyFloat Constructor

Creates a new Python float from a double value.

PyFloat ( string value ) : System

PyFloat Constructor

Creates a new Python float from a string value.

Method Details

AsFloat() public static method

AsFloat Method
Convert a Python object to a Python float if possible, raising a PythonException if the conversion is not possible. This is equivalent to the Python expression "float(object)".
public static AsFloat ( PyObject value ) : PyFloat
value PyObject
return PyFloat

IsFloatType() public static method

IsFloatType Method
Returns true if the given object is a Python float.
public static IsFloatType ( PyObject value ) : bool
value PyObject
return bool

PyFloat() public method

PyFloat Constructor
Creates a new PyFloat from an existing object reference. Note that the instance assumes ownership of the object reference. The object reference is not checked for type-correctness.
public PyFloat ( IntPtr ptr ) : System
ptr System.IntPtr
return System

PyFloat() public method

PyFloat Constructor
Copy constructor - obtain a PyFloat from a generic PyObject. An ArgumentException will be thrown if the given object is not a Python float object.
public PyFloat ( PyObject o ) : System
o PyObject
return System

PyFloat() public method

PyFloat Constructor
Creates a new Python float from a double value.
public PyFloat ( double value ) : System
value double
return System

PyFloat() public method

PyFloat Constructor
Creates a new Python float from a string value.
public PyFloat ( string value ) : System
value string
return System