PEP 318 - Function Modifier Syntax

Ian Bicking ianb at colorstudy.com
Wed Jun 11 16:07:53 EDT 2003


On Wed, 2003-06-11 at 13:33, Gerrit Holl wrote:
> Andrew Walkingshaw wrote:
> > > I think "as" is a perfectly good keyword, and no other suggestion I've
> > > seen is better.  It reads well and it represents the underlying
> > > implementation fairly well.  And "as" is already (kind of) a keyword, so
> > > all the better.  It was an early suggestion, and a good one -- I don't
> > > know why people are working it over so much.
> > 
> > Because we haven't anything better to do? :)
> > 
> > Another option which comes to mind, assuming that these function
> > decorators work the way I think they do, is "applying":
> > 
> > def f(x,y,z) applying (decorator1, decorator2):
> 
> How about "def f() alteritaccordingto (decorator1, decorator2):"

def f() notaplainfunctionactuallya (decorator1, decorator2):

def f() as decorator2(decorator1(x)) for x in y():

class f(method):
    def __call__(): ...

> Maybe Bar should be a class, so that using multiple inheritance,
> foo will be isinstance(foo, bar). This will also easy checking
> 'am-i-a-classmethod' easier.

Well, classmethod *is* a class, and isinstance(classmethod(foo),
classmethod) is true.  But classmethod instances are descriptors, so
you'd have to do something like isinstance(Bar.__dict__['foo'],
classmethod) to actually figure it out.

  Ian







More information about the Python-list mailing list