[Python-ideas] Re: Bringing the print statement back

2020-06-11 Thread MRAB
On 2020-06-11 22:15, Ethan Furman wrote: On 06/11/2020 01:18 PM, Rob Cliffe via Python-ideas wrote: If the new super-duper all-singing-and-dancing-and-make-the-tea parser can cope with 'print' without parens, it can cope with print followed by nothing. Good addition to the proposal,

[Python-ideas] Re: New syntax for dict literals

2020-06-11 Thread Abe Dillon
> > instead of prefixing a letter, we may be able to omit the key of > items inside dict display. d = {:name, :addr, ’tel': '123-4567’} > This is my favorite variation on the notation so far. I'll give it a +1 On Wed, Jun 10, 2020 at 10:49 AM Atsuo Ishimoto wrote: > Hi > Thank you for

[Python-ideas] Re: New syntax for dict literals

2020-06-11 Thread Robert DeLanghe
I like Atsou's suggestion of omitting the key for literals: d = {:name, :addr, ’tel': '123-4567’} but using empty kwargs feels gross: d = dict(=name, =addr, tel='123-456') And this feels like it could easily lead to confusion: d = dict(name, addr, tell='123-456') On Thu, Jun 11, 2020 at

[Python-ideas] Re: Bringing the print statement back

2020-06-11 Thread Ethan Furman
On 06/11/2020 01:18 PM, Rob Cliffe via Python-ideas wrote: If the new super-duper all-singing-and-dancing-and-make-the-tea parser can cope with 'print' without parens, it can cope with print followed by nothing. Good addition to the proposal, actually. :-) (Repeated for clarity: I'm in favour

[Python-ideas] Re: Bringing the print statement back

2020-06-11 Thread Rob Cliffe via Python-ideas
On 11/06/2020 16:45, Steven D'Aprano wrote: On Wed, Jun 10, 2020 at 08:00:26PM -0400, Jonathan Crall wrote: I wouldn't mind if this *only *worked for the specific characters "print". I would. What's so special about print? It's just a function. I use `iter` much more than print. Should we

[Python-ideas] Re: New syntax for dict literals

2020-06-11 Thread Abe Dillon
Stephen J. Turnbull > d = {first : first, last, addr1, addr2} I'm not a huge fan of this solution. It feels a bit like a hack instead of an intended syntax. Since prefixing characters on strings is already a thing, I lean more towards that solution. It's slightly easier to search (e.g. if the

[Python-ideas] Re: Bringing the print statement back

2020-06-11 Thread Jonathan Crall
> What's so special about print? It's just a function. I'd argue it's a pretty special function given its history. Just because it's used less frequently that something else doesn't mean it's not "special" in some sense. `iter x` never worked, whereas `print x` used to work, which is the only

[Python-ideas] Re: Bringing the print statement back

2020-06-11 Thread Calvin Spealman
On Tue, Jun 9, 2020 at 8:11 PM Guido van Rossum wrote: > In Python 3.10 we will no longer be burdened by the old parser (though 3rd > party tooling needs to catch up). > > One thing that the PEG parser makes possible in about 20 lines of code is > something not entirely different from the old

[Python-ideas] Re: Bringing the print statement back

2020-06-11 Thread Steven D'Aprano
On Wed, Jun 10, 2020 at 08:00:26PM -0400, Jonathan Crall wrote: > I wouldn't mind if this *only *worked for the specific characters "print". I would. What's so special about print? It's just a function. I use `iter` much more than print. Should we make a special exception for only 'iter' too?

[Python-ideas] Re: New syntax for dict literals

2020-06-11 Thread J. Pic
I find this interesting, another solution would be for locals() to take arguments: dict(tel='1337-1337', **locals('name', 'surname')) ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Bringing the print statement back

2020-06-11 Thread Steve Barnes
Of course ipython has a %autocall magic which, if set to 1: Lets you type `print 42, 43, 46, sep='-'` and have it work. Shows you the actual call so you can paste it If you use the %save magic to output to a file saves the actual call, (with parenthesis). You can set this as your

[Python-ideas] Re: Bringing the print statement back

2020-06-11 Thread Greg Ewing
On 11/06/20 2:08 pm, Jonathan Goble wrote: +1 for the limited idea of bringing back the print statement with positional arguments only, as syntactic sugar (and not a replacement) for the print function Would that apply only to the actual built-in print function, or would it work for any

[Python-ideas] Re: Bringing the print statement back

2020-06-11 Thread Greg Ewing
I seem to remember reading somewhere that some very early Lisp systems had a REPL that allowed you to omit the parentheses around a top-level call. But that feature seems to have sunk without trace in the swamps of history. I can't see a good reason for Python to refloat it. -- Greg