PEP 359: The "make" Statement

skip at pobox.com skip at pobox.com
Tue Apr 18 14:51:23 EDT 2006


    Carl> class some_attribute:
    Carl>     __metaclass__ = PropertyMaker
    Carl>     def get(self):
    Carl>         whatever
    Carl>     def set(self,value):
    Carl>         whatever

    Carl> But the thing is, if I did that, I'd be lying bastard....  With
    Carl> the make statement, I could instead write:

    Carl> make property some_attribute:
    Carl>     def get(self):
    Carl>     # etc.

    Carl> Then I'm not lying about it, and I'm using a more straightforward
    Carl> syntax.

I agree.  For the specific example of creating properties, you could
probably dream up some other syntax, but I suspect this notion will pop up
again.  Even if you comment the heck out of a lying class definition, tools
like pylint and pychecker will think you're creating a class anyway and
incorrectly apply their class heuristics to your whatever-it-is.

Skip



More information about the Python-list mailing list