cf.OF_FRACTION

cf.OF_FRACTION(*of_fraction)[source]

Return or set the number of concurrently open files above which files containing data arrays may be automatically closed.

Expressed as a fraction of the maximum possible number of concurrently open files.

Note that closed files will be automatically reopened if subsequently needed by a variable to access its data array.

Parameters :
of_fraction : float, optional

The new fraction (between 0.0 and 1.0).

Returns :
out : float or None

If of_fraction was not set return the existing value, otherwise return None.

Examples

>>> cf.OF_FRACTION()
0.5
>>> cf.OF_FRACTION(0.75)
>>> cf.OF_FRACTION()
0.75

The fraction may be translated to an actual number of files as follows:

>>> import resource
>>> max_open_files = resource.getrlimit(resource.RLIMIT_NOFILE)[0]
>>> threshold = int(cf.OF_FRACTION() * max_open_files)
>>> max_open_files, threshold
(1024, 768)

Previous topic

cf.MINNCFM

Next topic

cf.RTOL

This Page