why not extending the syntax for classes, too ?

holger krekel pyth at devel.trillke.net
Sat Feb 8 20:53:17 CET 2003


Erik Max Francis wrote:
> Michele Simionato wrote:
> 
> > I would agree with you with the use in functions, however my point
> > here is
> > that "is" can be extended to classes, whereas "as" cannot.
> 
> I don't understand this point, you seem to have completely sidestepped
> my objections.
> 
> As it stands, `is' already has a very specific meaning, and is totally
> unrelated to definition adornments.

True, that's why it's a good choice. 

>  `as' as a keyword is only used in
> conjunction with something else, and so seems to me much more apt in
> this capacity.
>  `as' itself doesn't mean anything without context; `is'
> does.

Isn't that exactly why 'as' is not a good idea?  With

    def check() as trace:
        ...

one could think that i have just defined a function named 
'trace' because somebody teached me how 'import name as othername' 
works.  Whereas

    def check() is traced:
        pass

pops up the question how 'traced' is defined.  Hardly
anybody would think this is a conditional expression. 

So it's a good thing that 'is' was not used for 'adornments' before.

    holger





More information about the Python-list mailing list