What's the difference between built-in func getattr() and normal call of a func of a class

Johnny johnnyandfiona at hotmail.com
Tue Aug 23 04:16:43 EDT 2005


Diez B. Roggisch wrote:
> No, it will only return _always_ a value if you provide a default one.
> If not, they have the exact same semantics.
>
> What you've got here is something usually called "syntactic sugaring" -
> a specialized syntax that performs certain instructions that _could_ be
> done by hand - but the concise syntax is (supposedly, and certainly in
> this case) easier to read/write/understand.
>
> There are others - e.g. list comprehensions or a < b < c.
>
> Regards,
> 
> Diez

Cool~
Thanks for showing me the "syntactic sugaring":)




More information about the Python-list mailing list