D
Dennis Benzinger
I vote FOR J2.
Dennis Benzinger
Dennis Benzinger
Pierre-Frédéric Caillaud said:Can we insert conditional expressions in the decorator list ?
Only in ternary operator format.Pierre-Frédéric Caillaud said:I'll vote for it.
Can we insert conditional expressions in the decorator list ?
Using proposed J2: (tested)
class Foo:
using:
staticmethod
eval("(memoise,esiomem)[x==0]")
def Hoo(Who, *args):
print "Yoo", Who
....Anthony said:Using proposed J2: (tested)
class Foo:
using:
staticmethod
eval("(memoise,esiomem)[x==0]")
def Hoo(Who, *args):
print "Yoo", Who
Why wouldn't you instead write this as:
Don't use eval unless it's absolutely necessary, _please_.
Robert said:...
Patch against current CVS passes all the tests* and has been uploaded
to SourceForge. I'm currently looking at how __future__ declarations
work.
Python 2.3.3 (#1, Apr 6 2004, 01:47:39)python
Michael Sparks said:Anthony Baxter wrote:
I suppose instead I could've had:
def identity(actualFunc):
def decorate(func):
return actualFunc(func)
return decorate
class Foo:
@staticmethod
@identity((memoise,esiomem)[x==1])
def Hoo(Who, *args):
print "Yoo", Who
Which is nicer, but still pretty hideous. I'd agree that the preceding
if statement approach is better than a conditional expression.
Michael Sparks said:It might (or might not) be too late but just as a check I checked
to see if "per" is used by any projects listed in the proposal. (I
was checking Twisted and Zope for "using" so decided to do "per" as well)
Tim said:I also have a weak preference for 'per' over 'using', FWIW. The
shortness of 'per' is one virtue. Another is that, because it's slightly
obscure, it may be easier to indoctrinate users that 'per...def' is the
correct order, not 'def...per'. For me at least it's 'obvious' that if
'using...def' works then so should 'def...using', which of course it
can't. The order is amenable to memorization, but I still anticipate
more thinkos of this type from using than from per. On the downside, per
may be extremely obscure to those that are neither native speakers of
English or one of the romance languages.
Doug Holton said:Even in common English usage, "per" usually comes in the middle of a
phrase, not the beginning, like "miles per hour" or "Changes were made
to the manuscript per the author's instructions" (people would more
commonly use the phrase "according to" rather than "per" there).
Doug said:Even in common English usage, "per" usually comes in the middle of a
phrase, not the beginning, like "miles per hour" or "Changes were made
to the manuscript per the author's instructions" (people would more
commonly use the phrase "according to" rather than "per" there).
None of those uses bare any resemblance to how decorators affect
functions. "per:" by itself on a line is pretty much meaningless.
Looks more like you misspelled pre.
Doug said:Even in common English usage, "per" usually comes in the middle of a
phrase, not the beginning, like "miles per hour" or "Changes were made
to the manuscript per the author's instructions" (people would more
commonly use the phrase "according to" rather than "per" there).
None of those uses bare any resemblance to how decorators affect
functions.
> "per:" by itself on a line is pretty much meaningless.
> Looks more like you misspelled pre.
If people are liking Latin keywords for decorators now, why not "sic"?
Paul said:I'm still not crazy about J2 but I like "per" much better than "using".
I'm afraid that the clpy proposals, and the @pie syntax, both seem to
me like "extreme programming", [ which isn't really very good for
language _design _ ]
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.