You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SUGGESTION: string version of sequence of attributes #298
The following piece of code could be added in the source code, which allows using myboxobj("a.b.c.d") instead of myboxobj.a.b.c.d. This simplifies some dynamic coding.
#!/usr/bin/env python3fromboximportBox# ---------------------- ## -- BETTER BOX CLASS -- ## ---------------------- ##### We make the class Box callable to allow the use of virtual# pointed paths.###classBoxPlus(Box):
#### prototype::# content : a pointed path similar to a sequence of# attribute request.## :return: the expected value.###def__call__(
self,
str_attrs
):
val=selfforninstr_attrs.split('.'):
val=getattr(val, n)
returnval
Activity