[Tutor] Changing the Attribute of a Variable
Marc Tompkins
marc.tompkins at gmail.com
Tue Feb 17 10:00:39 CET 2009
On Tue, Feb 17, 2009 at 12:16 AM, wesley chun <wescpy at gmail.com> wrote:
> marc: i will slightly disagree with you with regards to strftime *not*
> being an attribute. it *is* an attribute, just not a *data
> attribute*... i call it a "function attribute," but that's just
> terminology. any time you have an object x with an attribute y, the
> fact that you can issue x.y means that y is indeed an attribute of x.
> if it's a data attribute, you access it with x.y. if it's a function
> attribute, i.e., a method, you also access it with x.y, esp. if you
> want to pass the function object around, and finally, if you actually
> want to *execute* it *and* it's a method, then you add the parens,
> x.y().
>
Which follows from the fact that in Python, functions are objects too.
However, in the context of the OP's question, I think that if he referenced
strftime with no parentheses the result would NOT be what he expected or
intended; the distinction between methods and what you call "data
attributes" can be an important one. Point taken, though.
--
www.fsrtechnologies.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090217/d5fd7913/attachment.htm>
More information about the Tutor
mailing list