Previous topic

propy.bool_property

Next topic

propy.index_property

This Page

propy.str_property

propy.str_property(name)[source]

Creates a class property that is restricted to string values. All values set to the property will be converted to strings via str(). If that is not possible, an exception will be raised. To use, place the method within a class’s scope.

Parameters:
name : str

The name of the property to be created.

Examples

>>> class Class():
...     str1 = str_property('str1')