On Tue, Oct 11, 2011 at 01:49:43PM +0100, Michael Foord wrote: > On 10/10/2011 21:21, Giampaolo Rodolà wrote: > > > >Toshio Kuratomi<[email protected]> wrote: > >>I have a need to support a small amount of code as far back as python-2.3 > >>I don't suppose you're interested in that as well? ;-) > >I'm still not sure; 2.3 version is way too old (it doesn't even have > >decorators). > >It might make sense only in case the lib gets widely used, which I doubt. > >Personally, at some point I deliberately dropped support for 2.3 from > >all of my code/lib, mainly because I couldn't use decorators. so I > >don't have a real need to do this. > > Yes, rewriting code from Python 2.7 to support Python 2.3 > (pre-decorators) is a real nuisance. In my projects I'm currently > supporting Python 2.4+. I'll probably drop support for Python 2.4 > soon which will allow for the use of the with statement. > So actually, decorators aren't a big deal when thinking about porting a limited set of code to python-2.3. decorators are simply syntactic sugar after all, so it's only a one-line change::
@cache()
def function(arg):
# do_expensive_something
return result
becomes::
def function(arg):
# do_expensiv_something
return result
function = cache(function)
This may not be the preferred manner to write decorators but it's fairly
straightforward and easy to remember compared to, say, porting away from the
with statement.
That said, this was in the nature of hopeful, finger crossing, not really
expecting that I'd get someone else to commit to this as a limitation than
a, "this is not worthwhile unless you go back to python-2.3". I only have
to bear this burden until February 29 and believe me, I'm anxiously awaiting
that day :-)
-Toshio
pgpVhXAYYRc0x.pgp
Description: PGP signature
_______________________________________________ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
