POV-Ray : Newsgroups : povray.off-topic : OO theory? Python. : Re: OO theory? Python. Server Time
29 Jul 2024 04:27:51 EDT (-0400)
  Re: OO theory? Python.  
From: Darren New
Date: 22 Oct 2012 10:26:30
Message: <50855796$1@news.povray.org>
On 10/22/2012 6:53, Warp wrote:
> Darren New<dne### [at] sanrrcom>  wrote:
>> Having underlings as part of the name isn't any more "special" than it is in
>> C or C++.  However, I cannot name my own function "operator'" in C++ because
>> the "operator" keyword actually is special syntax.
>
> 'operator' is a keyword that's fairly descriptive. '__' in a variable name
> as required syntax isn't very descriptive.

That's a fair complaint.

>> I can name my function
>> __quote__ in Python because that function name has no special meaning to the
>> interpreter.
>
> That's contradictory with:
>
>> When the interpreter sees "a + b" it first looks to see who implements
>> __add__, and then invokes that.
>
> So it does have a special meaning to the interpreter, or it doesn't?

As I thought I said, __add__ has special meaning, __quote__ does not. It's 
not the presence of the __ that makes it magic. It's the entire name.

-- 
Darren New, San Diego CA, USA (PST)
   "They're the 1-800-#-GORILA of the telecom business."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.