homepage

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 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:26Fade78setrecipients: + Fade78
2012年03月30日 10:18:26Fade78setmessageid: <1333102706.9.0.091568052428.issue14451@psf.upfronthosting.co.za>
2012年03月30日 10:18:26Fade78linkissue14451 messages
2012年03月30日 10:18:26Fade78create

AltStyle によって変換されたページ (->オリジナル) /