The trouble with "dynamic attributes".
steve at REMOVE-THIS-cybersource.com.au
Mon Sep 20 08:30:30 CEST 2010
On Sun, 19 Sep 2010 16:47:26 +1000, Lie Ryan wrote:
> On 09/18/10 03:53, Ethan Furman wrote:
>> Lie Ryan wrote:
>>> And even dict-syntax is not perfect for accessing XML file, e.g.:
>>> should a['b'] be 'foo' or 'bar'?
>> Attribute style access would also fail in this instance -- how is this
> By not having multiple b in the first place!
Which works just as well for dict access.
Given that attribute access is nothing but syntactic sugar for dict
access, there is nothing you can do with attribute access that can't be
done with dict access. However, the same does not apply in reverse --
there are many things you can't do with attribute access that work fine
with dict access.
More information about the Python-list