Hi,
Just curious, why would bringing back Python 2’s print statement be a good idea?
Warm Regards,
Sadhana Srinivasan
On Wed, Jun 10, 2020 at 2:39 AM, Jonathan Goble <jcgob...@gmail.com> wrote:
> On Tue, Jun 9, 2020 at 8:08 PM Guido van Rossum <gu...@python.org> wrote:
>
>> I believe there are some other languages that support a similar grammar
>> (Ruby? R? Raku?) but I haven't investigated.
>
> Lua has a similar feature: a name (including a dotted name or index[ing],
> which are identical in Lua) immediately followed by a string literal or table
> literal is syntactic sugar for calling the named function/callable with that
> string or table as its only argument. This is commonly used with print() and
> require(), and also is sometimes used (with table literals) to simulate
> calling a function with named arguments.
>
> Lua allows this to be chained: for example, the line `require "math" "test"`
> is the same as `require("math")("test")`, calling the result of
> `require("math") with the argument "test". (Incidentally, `require "math"`
> returns a non-callable table, so actually running that will generate an error
> message saying "attempt to call a table value". So it's a bad example, but
> there are legitimate use cases for this.)
>
> However, Lua only supports this for single arguments (two or more require the
> parentheses) and only for an argument that is a string literal or table
> literal, nothing else (in particular, numbers and names require the
> parentheses).
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/BN7UNBLJNF2O5X2JHM2BOUJBKPIY7MBT/
Code of Conduct: http://python.org/psf/codeofconduct/