[Python-ideas] Desperate need for enhanced print function
rymg19 at gmail.com
Sat Sep 5 21:39:35 CEST 2015
On September 5, 2015 2:33:00 PM CDT, Anand Krishnakumar <anandkrishnakumar123 at gmail.com> wrote:
>This is my first time I'm sending an email to the python-ideas mailing
>list. I've got an enhancement idea for the built-in print function and
>hope it is as good as I think it is.
>Imagine you have a trial.py file like this:
>a = 4
>b = "Anand"
>print("Hello, I am " + b + ". My favorite number is " + str(a) + ".")
>print("Hello, I am ", b, ". My favorite number is ", a, ".")
>Well I've got an idea for a function named "print_easy" (The only valid
>name I could come up with right now).
>So print_easy will be a function which will be used like this (instead
>the current print statement in trial.py) :
>print_easy("Hello, I am", b, ". My favorite number is", a ".")
I'm sorry...but I can't see the difference. Aren't the two calls exactly the same??
>Which gives out:
>Hello, I am Anand. My favorite number is 4
>The work it does is that it casts the variables and it also formats the
>sentences it is provided with. It is exclusively for beginners.
>I'm 14 and I came up with this idea after seeing my fellow classmates
>school struggling to do something like this with the standard print
>Sure, you can use the format method but won't that be a bit too much
>beginners? (Also, casting is inevitable in every programmer's career)
>Please let me know how this sounds. If it gains some traction, I'll
>it a bit more and clearly list out the features.
Sent from my Nexus 5 with K-9 Mail. Please excuse my brevity.
More information about the Python-ideas