[Python-Dev] Replacement for print in Python 3.0
Barry Warsaw
barry at python.org
Sun Sep 4 18:51:02 CEST 2005
More information about the Python-Dev mailing list
Sun Sep 4 18:51:02 CEST 2005
- Previous message: [Python-Dev] Replacement for print in Python 3.0
- Next message: [Python-Dev] Replacement for print in Python 3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, 2005-09-03 at 12:51, James Y Knight wrote: > On Sep 3, 2005, at 11:32 AM, Barry Warsaw wrote: > > > So I think it's best to have two builtins: > > > > print(*args, **kws) > > printf(fmt, *args, **kws) > > It seems pretty bogus to me to add a second builtin just to apply the > % operator for you. I've always really liked that Python doesn't have > separate xyzf functions, because formatting is an operation you can > do directly on the string and pass that to any function you like. > It's much cleaner... Actually, we probably only /need/ printf(), and certainly for C programmers (are there any of us left? ;), I think that would be a small conceptual leap. The motivation for keeping a non-formatting version is for simple cases, and beginners -- both of which use cases should not be dismissed. The reason I proposed two versions is because I'd really dislike putting the format string in any position other than the first positional argument, and I can't think of a way to definitively distinguish between whether a first arg string is or is not a format string. One possible way out is to define a string literal that creates Template strings, and then make the Template string syntax rich enough to cover today's %-substitutions. Then if the first argument is a Template, you do printf()-like output otherwise you do print()-output. -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 307 bytes Desc: This is a digitally signed message part Url : http://mail.python.org/pipermail/python-dev/attachments/20050904/e506a9c9/attachment.pgp
- Previous message: [Python-Dev] Replacement for print in Python 3.0
- Next message: [Python-Dev] Replacement for print in Python 3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list