Fabians Bookmarks
  • Fabians Bookmarks
  • Tag cloud
  • Daily
  • RSS Feed
  • Login
Delete   Set public   Set private   Add tags   Delete tags
  Add tag   Cancel
  Delete tag   Cancel
17527 shaares · 14141 private links
Filters
Links per page
20 50 100

Recursive getattr/setattr « Mousebender

You can make a more compact implementations with help of the reduce builtin function:

def rec_getattr(obj, attr):
return reduce(getattr, attr.split(”.”), obj)

python programming code snippets
June 28, 2009 at 15:01:14 GMT+2
http://mousebender.wordpress.com/2006/11/10/recursive-getattrsetattr/
Filters
Links per page
20 50 100
By @fabian@floss.social · Powered by Shaarli
Fold Fold all Expand Expand all Are you sure you want to delete this link? Are you sure you want to delete this tag? The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community