[clug] Object-Oriented C?

Martin Pool mbp at sourcefrog.net
Wed Feb 22 04:47:04 GMT 2006

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.  

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : http://lists.samba.org/archive/linux/attachments/20060222/27ff0d94/attachment.bin

More information about the linux mailing list