syntax oddities
Gregory Ewing
greg.ewing at canterbury.ac.nz
Thu May 17 04:48:01 EDT 2018
> On Tue, 15 May 2018, 23:15 Tobiah, <toby at tobiah.org> wrote:
>
>>Why is it getattr(object, item) rather then object.getattr(item)?
It's part of the design philosophy of Python that the
namespace of a new user-defined class should as far as
possible start off as a "blank slate", not cluttered
up with a bunch of predefined names. So, very general
things like getattr() that apply to any object are
implemented as functions that operate on an object,
rather than methods.
--
Greg
More information about the Python-list
mailing list