Steven Bethard wrote:
There must be something wrong with this idea that I'm missing. . .


Well, it does cost you some conciceness, as your examples show[1]:

lazy(mul, x, y)                     v.s.   :x * y
lazy(itemgetter(i), x)              v.s.   :x[i]
lazy(attrgetter("a"), x)            v.s.   :x.a
lazycall(lazy(attrgetter("a"), x))  v.s.   :x.a()

Not sure how I feel about this yet. I don't personally need lazy argument evaluation often enough to be able to decide which syntax would really be clearer...

I think you've hit the downside on the head, though. Any time you have to use the operator module, you take a big hit in verbosity (particularly since noone ever came up with better names for attrgetter and itemgetter. . .)


There's a reason people like list comprehensions :)

Ah well, I'll let it bake for a while - I'm still not entirely sure about it myself, since I'm in a similar boat to you w.r.t. lazy evaluation (I usually just define functions that do what I want and pass them around).

Cheers,
Nick.

--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
            http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to