Message157133
| Author |
Fade78 |
| Recipients |
Fade78 |
| Date |
2012年03月30日.10:18:26 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1333102706.9.0.091568052428.issue14451@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The built-in functions working with iterable should also work with single object that is relevent.
For example:
max([1,6,5]) -> 6
max(6) -> TypeError because not an iterable (actual behavior)
max(6) -> 6 (wanted pythonic behavior)
So if I write a generic function like this:
def f(x):
totalsum+=sum(x)
it fails if x is not an iterable. But I want the argument to be anything possible. Using if(type) to separate use cases is not very pythonic. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年03月30日 10:18:26 | Fade78 | set | recipients:
+ Fade78 |
| 2012年03月30日 10:18:26 | Fade78 | set | messageid: <1333102706.9.0.091568052428.issue14451@psf.upfronthosting.co.za> |
| 2012年03月30日 10:18:26 | Fade78 | link | issue14451 messages |
| 2012年03月30日 10:18:26 | Fade78 | create |
|