Message55027
| 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:36 | admin | link | issue1673203 messages |
| 2007年08月23日 16:12:36 | admin | create |
|