Am 16.10.2009 um 17:45 schrieb Alan G Isaac:
On 10/16/2009 11:25 AM, André Wobst wrote:BTW note that sum is designed for numerics only.That seems a bit strong. How about, "numerics originally*.That's why sum([]) returns 0 and sum(["spam", "eggs"]) is not allowed. By the way for strings it even doesn't work with sum(["spam", "eggs"], ""), which I think is weirdI consider it a bug (as a violation of duck typing). There is an efficiency reason to use `join`, but it is beyond weird to enforce it.
Me too.But the numerics-only (without setting a start value) is a good starting point. That allows for a proper return value in case of an empty list in the first parameter of the sum function. For sum([], path.path()) it will be an empty path. That's perfect. And I agree: disallowing sum for strings at all is a weird decision. As this case is already caught, it could also just be done efficiently. "".join() with an empty separator doesn't look too efficient either.
Anyway, we're clearly getting off-topic ... :-) André -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) [email protected], http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/
smime.p7s
Description: S/MIME cryptographic signature
------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference
_______________________________________________ PyX-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyx-user
