Two minor syntactic proposals
John Roth
johnroth at ameritech.net
Thu Jun 21 16:55:30 EDT 2001
"phil hunt" <philh at comuno.freeserve.co.uk> wrote in message
news:slrn9j275n.9oi.philh at comuno.freeserve.co.uk...
> On Wed, 20 Jun 2001 18:44:16 GMT, Bengt Richter <bokr at accessone.com>
wrote:
> >On 18 Jun 2001 11:57:59 -0700, jeff at ccvcorp.com (Jeff Shannon) wrote:
> >
> >>philh at comuno.freeserve.co.uk (phil hunt) wrote in message
news:<slrn9ipjok.5je.philh at comuno.freeserve.co.uk>...
> >>>
> >>> I propose a different way of doing this: make 'self' implied in all
> >>> references to instance variables. This involves definiing 2 new
keywords,
> >>> qclass and insvars. So:
> >I think I prefer just an easier way to type "self."
> >How about just the dot? I.e., ".x" means "self.x"
>
> That sounds a good idea.
I like it! I don't think it will break anything.
However, since you wouldn't have to type "self." any more,
then the "self" parameter itself becomes meaningless, and can be
eliminated. This also solves the "class method" issue. If it doesn't
contain a prefixed dot, then it doesn't require an instance, so it's
clearly a class method.
It'll never fly. Think of all that code out there that would break if we
took away that first parameter... And then, there's the point that keeps
getting pounded to death in the PEP255 discussion - it's bad news to
distinguish two different animals by some detail of their internals.
> >>I much prefer having all member variables and member functions
explicitly
> >>qualified. Having moved to Python from C++, where members can be
referred
> >>to implicitly, it seems to me that the explicit requirement of Python
makes
> >>code *much* easier to read--no more hunting about to try to figure out
whether
> >>a given variable is a class member, or a parameter, or a global, or from
some
> >>other scope... then there's also this problem (using your notation):
> >[...more reasons...]
> >
> >So what about a plain prefixed '.' as an abbreviation for 'self.' ?
>
> i wish i'd thought of it
>
> --
> ## Philip Hunt ##
> ## philh at comuno.freeserve.co.uk ##
>
>
>
More information about the Python-list
mailing list