Sat, 6 Apr 2002 09:28:23 -0500
On Sat, Apr 06, 2002, Fredrik Lundh wrote:
> barry wrote:
>> I'm curious why setting an attribute isn't a name binding operation?
>> Are you binding the object to the attribute name in the object's
>> attribute namespace? Since that maps to a setting in an __dict__
>> (usually), what /would/ you call it?
> syntactic sugar?
> A = 1 binds 1 to the name "A"
> A.B = 1 calls A.__setattr__("B", 1)
> A["B"] = 1 calls A.__setitem__("B", 1)
> it's pretty clear that the first form differs from the others,
> but what's the difference between the second and the third
> form? or are all three name binding operations?
The way I'm currently thinking of this (thanks to Barry) is that all
three are target binding operations. I'm currently leaning toward
attributes being names because (like primaries) they go through namespace
lookup on reads, but I'm open to counter-arguments.
Aahz (firstname.lastname@example.org) <*> http://www.pythoncraft.com/
"There are times when effort is important and necessary, but this should
not be taken as any kind of moral imperative." --jdecker