Why we will use obj$func() often

Mark Hahn mark at prothon.org
Wed Apr 28 16:00:15 EDT 2004


Donn Cave wrote:
> In article <5vJjc.13116$Qy.1954 at fed1read04>,

> Well, in a sense this (&var) is a simplistic avoidance of scope.  Scope
> is how unqualified identifiers are resolved.

Scope is a noun, not a verb.  To me a scope is just a namespace defined by
syntax.  There are many ways to specify what scope a var belongs in, and
qualification using &var is just as valid as any other.

> Greg points out that it doesn't handle more complex usage like nested
> functions (and Simon's list comprehension / loop).  You can dismiss
> those as uncommon problems, but then this whole feature addresses
> a problem that bothers only those who choose to be afflicted.

It turns out that Greg and I were mistaken.  The &var syntax can easily
handle unlimited nested scopes and not even slow up my one-pass compiler.  I
explained this on the Prothon list.

I'll take a look at Simon's list comprehension problem next.  There might be
a solution for that also.

> As I said there, declaration isn't an interesting part of that,
> but the idea that declarations are "not Pythonic" strikes me as
> particularly absurd (not to mention just seeing you, of all people,
> offer this criticism.)

I didn't mean to be critical, just stating pros and cons.

> What is "class"?

Be fair.  You know that I didn't throw out classes on a capricious whim.

> What is "def"?

I go through crazy moments where I consider every possibility and throw out
ideas.  I considered the idea of replacing def with func (def is misnamed
after all) and that proposal lasted about 30 minutes.  Another idea that
lasted about 45 minutes was changing __init__ to init.  Please don't hold
anything against me during these trial-idea times.  Wait until you see the
final Prothon before you criticize my wanton destruction of the Python
heritage.  It also wouldn't hurt to hear you voice on the Prothon mailing
list influencing the outcome.





More information about the Python-list mailing list