Am 18.09.2016 um 12:16 schrieb Riccardo (Jack) Lucchetti:
* enable print to output expressions rather than simple variables (we
alredy have eval for that though)
Yes, the issue print-vs.-eval has come up several times. In principle
"eval" should be made redundant by extending "print" to become the
union
of what is now print and eval -- if I'm not missing something, that is.
* envisage some syntax so that you have a pre-cooked set of
"sensible"
choices via a multi-argument "print" _function_, as in
print("hi:", stringvar, "!, you are the", n, "-th person
I've met!")
which would also have the advantage of handling expressions natively.
In this example, the idea would be that if "n" is an integer, we
automatically apply "%d", otherwise we go for "%g", etcetera
etcetera.
Exactly. The only thing I don't quite understand is why does it have to
be a function instead of a command (or both). Ok, famously Python's most
obvious change from 2 to 3 was that 'print' became a function, too. But
in the hansl context, what's the rationale? Extending the print command
would seem more intuitive from a user's point of view. Or to put it
differently: Otherwise why allow the current 'print' command if
functions are so much better?
thanks,
sven