Jump to content

Add a variable to a class instance at runtime: Difference between revisions

Line 129:
vect += 'delta'
vect.dump()</lang>
Output from the above:
<lang falcon>0: alpha
1: beta
2: gamma
3: delta</lang>
'''Dictionary:'''
In this example we will add a variable through the use of an object from a bless'ed dictionary. We create a new variable called 'newVar' at runtime and assign a string to it. Additionally we assign an external, to the object, function (sub_func) to the variable 'sub'.
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.