On 16/08/07, Ron Adam <[EMAIL PROTECTED]> wrote: > Currently these particular examples aren't the syntax supported by the PEP. > It's an alternative/possibly syntax only if there is enough support for a > serial left to right specification pattern as outlined.
Ah, I hadn't realised that. I've been skipping most of the discussions, mainly because of the lack of concrete examples :-) > I think most of developers here are still looking at various details and > are still undecided. Do you have a preference for one or the other yet? As evidenced by the fact that I failed to notice the difference, I can't distinguish the two :-) All of the examples I've seen are hard to read. As Greg said, I find that I have to study the format string, mentally breaking it into parts, before I understand it. This is in complete contrast to printf-style "%.10s" formats. I'm not at all sure this is anything more than unfamiliarity, compounded by the fact that most of the examples I see on the list are relatively complex, or edge cases. But it's a major barrier to both understanding and acceptance of the new proposals. I'd still really like to see: 1. A simple listing of common cases, maybe taken from something like stdlib uses of %-formats. Yes, most of them would be pretty trivial. That's the point! 2. A *very short* comparison of a few more advanced cases - I'd suggest formatting floats as fixed width, 2 decimal places (%5.2f), formatting 8-digit hex (%.8X) and maybe a simple date format (%Y-%m-%d). Yes, those are the sort of things I consider advanced. Examples I've seen in the discussion aren't "advanced" in my book, they are "I'll never use that" :-) 3. Another very short list of a couple of things you can do with the new format, which you can't do with the existing % formats. Concentrate here on real-world use cases - tabular reports, reordering fields for internationalisation, things like that. As a data point, I've never needed to centre a field in a print statement. Heck, I don't even recall ever needing to specify how the sign of a number was printed! I get the impression that the "clever" new features aren't actually going to address the sorts of formatting problems I hit a lot. That's fine, I can write code to do what I want, but there's a sense of YAGNI about the discussion, because (for example) by the time I need to format a centred, max-18, min-5 character number with 3 decimal places and the sign hard to the left, I'm also going to want to dot-fill a string to 30 characters and insert commas into the number, and I'm writing code anyway, so why bother with an obscure format string that only does half the job? (It goes without saying that if the format string can do everything I want, that argument doesn't work, but then we get to the complexity issues that hit regular expressions :-)) Sorry if this sounds a bit skeptical, but there's a *lot* of discussion here over a feature I expect to use pretty infrequently. 99% of my % formats use nothing more than %s! Paul. _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
