Re: Parentheses (as after "print")

2017-09-27 Thread Thomas Jollans
On 26/09/17 17:56, Stefan Ram wrote: > What happened? I woke up today in parens mood. So I typed: > > import( operator ) > > Python told me that I should type: > > import operator This is an interesting case: >>> import (os, sys) File "", line 1 import (os, sys) ^ SyntaxError

Re: Parentheses (as after "print")

2017-09-27 Thread Chris Angelico
On Wed, Sep 27, 2017 at 5:25 PM, Peter Otten <__pete...@web.de> wrote: > If you want that level of -- let's call it consistency -- you should either > plead for > > foo = import("foo") > > to spell an import Yeah no thanks. I work also with JavaScript, and there is no benefit whatsoever to having

Re: Parentheses (as after "print")

2017-09-27 Thread Peter Otten
Stefan Ram wrote: > Why do we newbies write »print 2«? Here's another hint. > This is an original transcript of what happened to me today: > > |>>> import( operator ) > | File "", line 1 > |import( operator ) > | ^ > |SyntaxError: invalid syntax > | > |>>> import operator > | >

Re: Parentheses (as after "print")

2017-09-27 Thread Steven D'Aprano
On Wed, 27 Sep 2017 02:48:41 +, Stefan Ram wrote: > Steve D'Aprano writes: >>"Do What I Mean" (DWIM) programming is a terrible idea. > > It's an anti-pattern, when one expects the implementation to follow > different and contradicting rules and then somehow guess what was in > the mind

Re: Parentheses (as after "print")

2017-09-26 Thread Ben Finney
r...@zedat.fu-berlin.de (Stefan Ram) writes: > But it's a pattern when it means to strip the language > of useless boilerplate and still following consistent > and simple rules. That was what made Python great. Yes. Python syntax allows for *mentioning* an object, and also allows for *calli

Re: Parentheses (as after "print")

2017-09-26 Thread Ben Finney
r...@zedat.fu-berlin.de (Stefan Ram) writes: > Why do we newbies write »print 2«? Here's another hint. > This is an original transcript of what happened to me today: […] > What happened? I woke up today in parens mood. So I typed: > > import( operator ) So, are you making the case that peo

Re: Parentheses (as after "print")

2017-09-26 Thread MRAB
On 2017-09-27 03:48, Stefan Ram wrote: Steve D'Aprano writes: "Do What I Mean" (DWIM) programming is a terrible idea. It's an anti-pattern, when one expects the implementation to follow different and contradicting rules and then somehow guess what was in the mind of the programmer.

Re: Parentheses (as after "print")

2017-09-26 Thread Steve D'Aprano
On Wed, 27 Sep 2017 06:00 am, Stefan Ram wrote: > Python could have taken the indentation of the > next line to tell that this is supposed to be > a function definition and not a function call. "Do What I Mean" (DWIM) programming is a terrible idea. -- Steve “Cheer up,” they said, “things cou

Re: Parentheses (as after "print")

2017-09-26 Thread Chris Angelico
On Wed, Sep 27, 2017 at 6:00 AM, Stefan Ram wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes: >>Stefan Behnel writes: >>>But would you also write this? > ... >>>def(func(a,b,c)): >>>return(a+b+c) >>No, this not. > > What I wrote was like: > > func( a, b, c ) > return a+b+c >

Re: Parentheses (as after "print")

2017-09-26 Thread Chris Angelico
On Wed, Sep 27, 2017 at 5:19 AM, Stefan Behnel wrote: > print() and help() are definitely not worth being keywords. They do not > impact the program flow, they don't do any assignments, nothing. That's why > they are simple functions. If anything, help() could benefit more from language support t

Re: Parentheses (as after "print")

2017-09-26 Thread Stephan Houben
Op 2017-09-26, Stefan Ram schreef : > What happened? I woke up today in parens mood. So I typed: > > import( operator ) > > Python told me that I should type: > > import operator > > . Fine, Python conditioned me to omit the parens. > So now I was in noparens mood. So I typed: > > help ope

Re: Parentheses (as after "print")

2017-09-26 Thread Stefan Behnel
Stefan Ram schrieb am 26.09.2017 um 17:56: > Why do we newbies write »print 2«? Here's another hint. > This is an original transcript of what happened to me today: > > |>>> import( operator ) > | File "", line 1 > |import( operator ) > | ^ > |SyntaxError: invalid syntax > | > |>>