Reflection/List properties: Difference between revisions

Line 272:
#[('__class__', <class '__main__.Child'>), ..., ('args', (0, 'I', 'two')), ('args_bleh', "(0, 'I', 'two') bleh"), ('doNothing', <bound method Child.doNothing of Child(chld, 0, 'I', 'two')>), ('doStuff', <bound method Child.doStuff of Child(chld, 0, 'I', 'two')>), ('name', 'chld'), ('name_bleh', 'chld bleh'), ('own', "chld's own"), ('own_bleh', "chld's own bleh"), ('reBleh', <_sre.SRE_Pattern object at 0x10067bd20>), ('reBleh_bleh', '<_sre.SRE_Pattern object at 0x10067bd20> bleh')]
</lang>
 
=={{header|zkl}}==
In zkl, properties are static read only informational data.
 
Every object has a "properties" method, which returns a list of property names [for that object].
<lang zkl>properties:=List.properties;
properties.println();
List(1,2,3).property(properties[0]).println(); // get value
List(1,2,3).Property(properties[0])().println(); // method that gets value
List(1,2,3).BaseClass(properties[0]).println(); // another way to get value</lang>
{{out}}
<pre>
L("size","isReadOnly","id","name","fullName","type","otype","oID","itype","typeID","properties","methods","vaultPath","numObjects","isThreadSafe","isContainer","createReturnsSelf")
L(24,32)
L(24,32)
L(24,32)
</pre>
Anonymous user