PYSON is the PYthon Statement and Object Notation.
There is also a more practical introduction into PYSON statements.
Base class of any PYSON statement. It is never used directly.
Instance methods:
Method that returns the internal dictionary representation of the statement.
Method that returns a set of all possible types which the statement can become when evaluated.
Method which returns the evaluation of the statement given in dct within the context. dct contains a dictionary which is the internal representation of a PYSON statement. context contains a dictionary with contextual values.
Encoder for PYSON statements into string representations.
Instance method:
- PYSONEncoder.encode(object)¶
Returns a string representation of a given PYSON statement. object contains a PYSON statement.
Decoder for string into PYSON statement representation.
Instance method:
- PYSONDecoder.decode(object)¶
Returns a PYSON statement representation of a given string. object contains a string.
The following statements can be used in PYSON.
An Eval() object represents the PYSON Eval() statement for evaluations. When evaluated, it returns the value of the statement named by value, if defined in the evaluation context, otherwise the default value (empty string by default). Returns an instance of itself.
A Not object represents the PYSON Not() statement for logical negations. When evaluated, returns the boolean negation of the value of the statement named by value, if defined in the evaluation context. Returns an instance of itself.
A Bool object represents the PYSON Bool() statement for boolean evaluations. Returns the boolean representation of the value of the statement named by value.
An And object represents the PYSON And() statement for logical and operations. Returns the result of the logical conjunction of two or more values named by the statements in the statements tuple.
An Or object represents the PYSON Or() statement for logical or operations. Returns the result of the logical disjunction of two or more values named by the statements in the statements tuple.
An Equal object represents the PYSON Equal() statement for equation comparisons. Returns true when a value of a statement named by statement1 and the value of a statement named by statement2 are equal, otherwise returns false.
A Greater object represents the PYSON Greater() statement for greater-than comparisons. Returns true when the value of the statement named by statement1 is strictly greater than the value of the statement named by statement2, otherwise returns false. Is the value of the variable named by equal is true, then returns also true when both values of statements named by statement1 and statement2 are equal. In this case Greater works as a greater-than or equal operator.
A Less object represents the PYSON Less() statement for less-than comparisons. Returns true when the value of the statement named by statement1 is strictly less than the value of the statement named by statement2, otherwise returns false. Is the value of the variable named equal is true, then returns also true when both values of the statements named by statement1 and statement2 are equal. In this case Less works as a less-than or equal operator.
An If object represents the PYSON If() statement for conditional flow control operations. Returns the value of the statement named by then_statement when the value of the statement named by condition evaluates true. Otherwise returns the value of the statement named by else_statement.
A Get object represents the PYSON Get() statement for dictionary look-up operations and evaluation. Look up and returns the value of a key named by key in an object named by obj if defined. Otherwise returns the value of the variable named by default.
An In object represents the PYSON In() statement for look-up dictionary or integer objects. Returns true when a list (or dictionary) object named by obj contains the value of the variable (or key) named by key. Otherwise returns false.
A Date object represents the PYSON Date() statement for date related conversions and basic calculations. Returns a date object which represents the values of arguments named by the variables explained below. Missing values of arguments named by year or month or day take their defaults from the actual date. When values of arguments named by delta_* are given, they are added to the values of the appropriate arguments in a date and time preserving manner.
Arguments:
A DateTime object represents the PYSON Date() statement for date and time related conversions and calculations. Returns a date time object which represents the values of variables named by the arguments explained below. Missing values of arguments named by year, month, day, hour, minute, second, microseconds take their defaults from the actual date and time. When values of arguments named by delta_* are given, these are added to the appropriate attributes in a date and time preserving manner.
Arguments: