Nick Coghlan <[EMAIL PROTECTED]> wrote: > > Josiah Carlson wrote: > > Samuele Pedroni <[EMAIL PROTECTED]> wrote: > [snip] > >>well, I think some people desire a more streamlined way of writing code > >>like: > >> > >>def f(...) > >>... > >>def g(...) > >>... > >>x = h(...,f,g) > >> > >>[property, setting up callbacks etc are cases of this] > > > > > > > > I think properties are the most used case where this kind of thing would > > be nice. Though the only thing that I've ever had a gripe with > > properties is that I didn't like the trailing property() call - which is > > why I wrote a property helper decorator (a use can be seen in [1]). But > > my needs are small, so maybe this kind of thing isn't sufficient for > > those who write hundreds of properties. > [snip] > > I'm still trying to decide if the following is an elegant solution to > defining > properties, or a horrible abuse of function decorators:
[snip example] The only issue is that you are left with a closure afterwards, no big deal, unless you've got hundreds of thousands of examples of this. I like your method anyways. - Josiah _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com