This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author josiahcarlson
Recipients
Date 2007-03-22.17:49:10
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
twobitsprite: your use-case is different from that of others.  While you could use an identity function for your purposes, a lambda would work just fine.  Regardless, there is call overhead, which can only be reduced by not performing a call at all.

In terms of an identity function versus tuple creation and indexing as per belopolsky's suggestion...

>>> timeit.Timer("x(1+2,3+4)", "x = lambda *args:args[-1]").timeit()
0.99381552025397468
>>> timeit.Timer("(1+2,3+4)[-1]", "").timeit()
0.49153579156927663

Tuple is faster.  Just use a tuple.
History
Date User Action Args
2007-08-23 16:12:36adminlinkissue1673203 messages
2007-08-23 16:12:36admincreate