On 3/23/2019 7:35 PM, Juancarlo Añez wrote:
I know it has been discussed endlessly,
So please read any of the endless discussions either on this list or
python-list. I myself have answered multiple times.
--
Terry Jan Reedy
___
Python-ideas mail
I agree with Guido. Yes, there are sequences of symbols that used to be
syntax errors but that now have some meaning in Python. The type annotation
colon is one of them. There are moderately many other constructs this can
be said of.
I can vaguely imagine accidentally using a colon rather than an
I know it has been discussed endlessly, so just a gentle reminder about the
final arguments would be good. I think I remember it was discussed
recently, mentioning that join() doesn't convert elements to strings?
This came up while reading this speculative article about how programmers
migrate fro
On Sat, Mar 23, 2019 at 2:43 PM Andre Roberge
wrote:
> My original message was referring to someone writing ":" instead of "=" by
> mistake -- nothing to do with the walrus assignment, but rather using the
> same notation to assign a value to a key as they would when defining a dict.
>
OK, I rea
On Sat, Mar 23, 2019 at 6:26 PM Ned Batchelder
wrote:
> On 3/23/19 1:37 PM, Gregory P. Smith wrote:
> > Sure, someone is going to typo and omit the = from a := assignment in
> > 3.8 but the walrus is unlikely to be used outside of an conditional or
> > loop test context so this seems like a made
On 3/23/19 1:37 PM, Gregory P. Smith wrote:
Sure, someone is going to typo and omit the = from a := assignment in
3.8 but the walrus is unlikely to be used outside of an conditional or
loop test context so this seems like a made up problem.
Walruses aren't allowed as a top-level expression any
On Sat, Mar 23, 2019 at 12:44:29PM -0700, Gregory P. Smith wrote:
> Unfortunately that isn't what PEP 526 said:
> https://www.python.org/dev/peps/pep-0526/#annotating-expressions
Which part though? I'd understand ...
(x): int # Annotates x with int, (x) treated as expression by compiler.
On Sat, Mar 23, 2019 at 11:00 AM Stefan Krah wrote:
> On Sat, Mar 23, 2019 at 10:37:43AM -0700, Gregory P. Smith wrote:
> > A useless statement like that isn't likely to be typed. I've never seen
> > anyone do that.
>
> Unlikely yes, but ideally type annotations should not alter program
> behavi
On Sat, Mar 23, 2019 at 10:37:43AM -0700, Gregory P. Smith wrote:
> A useless statement like that isn't likely to be typed. I've never seen
> anyone do that.
Unlikely yes, but ideally type annotations should not alter program behavior:
>>> d = {}
>>> try: d["x"]
... except KeyError: print("KeyEr
On Sat, Mar 23, 2019 at 7:37 AM Andre Roberge
wrote:
> Consider the following example [1]:
>
> Python 3.7.0 (v3.7.0:1bf9cc5093...
> >>> d = {
> ... "injury": "flesh wound"
> ... }
> >>> d["answer"]: 42
> >>> if "answer" in d:
> ... print("Don't panic!")
> ... else:
> ... print(
> > I think that's a good indication that there are uses for a merge
> > operator.
>
> Some, yes. Enough for new syntax?
Let’s be clear here — this would not be new syntax — the operator (s)
already exist and are commonly used and overloaded already. This would be a
minor change to the dictionar
Consider the following example [1]:
Python 3.7.0 (v3.7.0:1bf9cc5093...
>>> d = {
... "injury": "flesh wound"
... }
>>> d["answer"]: 42
>>> if "answer" in d:
... print("Don't panic!")
... else:
... print("Sorry, I can't help you.")
...
Sorry, I can't help you.
= =
No SyntaxErr
12 matches
Mail list logo