super, decorators and gettattribute
Michele Simionato
michele.simionato at gmail.com
Mon Jan 14 13:53:49 CET 2008
On Jan 14, 1:41 pm, Richard Szopa <ryszard.sz... at gmail.com> wrote:
> However, there's one piece that doesn't completely fit to the puzzle:
> why does getattr work? The help says:
>
> getattr(...)
> getattr(object, name[, default]) -> value
>
> Get a named attribute from an object; getattr(x, 'y') is
> equivalent to x.y.
> When a default argument is given, it is returned when the
> attribute doesn't
> exist; without it, an exception is raised in that case.
>
> Does it work on the basis that "getattr(x, 'y') is equivalent to x.y"?
> What is then a "named attribute for an object" in Python? It seems not
> to be equivalent to the value of the item whose name is 'y' in the
> object's class __dict__...
>
> Cheers,
>
> -- Richard
I really need to publish this one day or another, since these
questions
about super keeps coming out:
http://www.phyast.pitt.edu/~micheles/python/super.html
More information about the Python-list
mailing list