On 02-Oct-07, at 9:18 AM, Tzury wrote:

>
> utils.Storage is one of the reusable components that makes one wonder
> how come it is not integral part of Python. It gives my configuration
> files an elegant name-spacing, and I use it instead of dict anywhere
> it make sense.

You can't always use it as replacement of dict. You have to be  
careful about the methods of dict.

 >>> d = web.storage()
 >>> d.keys = [1, 2]
 >>> d.keys
<built-in method keys of Storage object at 0x11770c8>

> hard-coding came out simple:
> Instead of:
> x = Storage({'server': {'username': 'root', 'password': 'pa$$word',
> 'ip': '1.1.1.1'}})
> I can write:
> x = Storage({'server': Storage( {'username': 'root', 'password': 'pa$
> $word', 'ip': '1.1.1.1'})})

Zen of Python:

Explicit is better than Implicit.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to