optparse

Steven Bethard steven.bethard at gmail.com
Thu May 12 00:39:30 EDT 2005


Andrew Dalke wrote:
> Steven Bethard wrote:
> 
>>Well one reason might be that it's easy to convert from an object's 
>>attributes to a dict, while it's hard to go the other direction:
> 
>   ...
> 
>>py> options['x'], options['y']
>>('spam', 42)
>>py> o = ??? # convert to object???
>>...
>>py> o.x, o.y
>>('spam', 42)
> 
> "hard" == "slightly less easy"?

No, sorry, "hard" -> "harder".  Typo.  For simple cases like this, it's 
obviously not difficult, though it does take more work than the opposite 
direction.

If you didn't catch the old discussions about some of the details, I 
think they're under something like "generic objects" or "namespace 
objects".  You can check the archives if you're interested.

STeVe



More information about the Python-list mailing list