PSCF v1.1
Classes | Functions
pscfpp.param Namespace Reference

Module for parsing param files. More...

Classes

class  Array
 Container for data of an array in a param file. More...
 
class  Composite
 Container for data of a Composite in a param file. More...
 
class  Matrix
 A Matrix represents a matrix-valued parameter in parameter file. More...
 
class  Parameter
 A Parameter represents a single parameter in a parameter file. More...
 

Functions

def getValue (v)
 Distinguish the type of a value from its string representation. More...
 

Detailed Description

Module for parsing param files.

Function Documentation

◆ getValue()

def pscfpp.param.getValue (   v)

Distinguish the type of a value from its string representation.

This function infers the type of a variable from its string representation and returns a value of the appropriate type, which may be an int, float or string. Any input string that can be interpreted as an integer is converted into the resulting int value. Any string that can be interpreted as a real number but not as an integer is converted into a float value. All other strings are left un-interpreted and returned verbatim as string values.

Parameters
va string representation of a parameter value

Definition at line 827 of file param.py.

Referenced by pscfpp.param.Parameter.__init__(), pscfpp.param.Composite.read(), pscfpp.param.Array.read(), pscfpp.param.Matrix.read(), pscfpp.param.Parameter.setValue(), pscfpp.param.Array.setValue(), and pscfpp.param.Matrix.setValue().