By Date: <-- -->
By Thread: <-- -->

Object-Oriented C?



On 22 Feb 2006, David Gibson <david (at) gibson.dropbear.id.au> wrote:

> On Wed, Feb 22, 2006 at 01:17:06PM +1100, Paul Wayper wrote:
> There's nothing "pseudo" about your approach.  The object-orientation
> is in how you organize your data and code with respect to each other,
> not in the mere syntactic sugar of whether you need to explicitly pass
> the "self" object to a method.  

Hear hear.

> (Note for example that in Python, the
> implementation of each method sees 'self' as an explicit, named,
> parameter; instance.method(...) is exactly equivalent to explicitly
> calling class.method(instance, ...) ).
 
By way of trivia: they're very similar but not exactly the same.  In
particular in the first case Python will first search the instance for
the 'method' name, which means it can match something specific to the
instance, and will invoke the instance's __getattr__ method if it has
one.  (One can, for example, have per-instance rather than per-class
methods.)  As you say in either case the instance is the first argument.  

-- 
Martin

Attachment: signature.asc
Description: Digital signature

-- 
linux mailing list
linux (at) lists.samba.org
https://lists.samba.org/mailman/listinfo/linux