On 30/04/22 5:25 am, MRAB wrote:
I was going to suggest "metastable". Too late? :-)
What, the API is balanced on a knife edge and likely to collapse
into something else if you sneeze too hard?
--
Greg
___
Python-Dev mailing list --
suggest having a small kernel written
in C, and write the rest using a tool similar to Cython that will
take care of all the tricky reference counting for you.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email
that there were some internal language reasons
to want stable dicts, e.g. so that the class dict passed to __prepare__
preserves the order in which names are assigned in the class body. Are
there any such use cases for stable sets?
--
Greg
___
Python-D
Barry Warsaw wrote:
Subclassing
SyntaxError is then a pragmatic concession to the fact that "SyntaxError"
also de facto means "CompilationError”
Perhaps there should be a CompilationError tghat SyntaxError and
TargetScopeError are subclass
x
... x = 5
...
File "", line 2
SyntaxError: no binding for nonlocal 'x' found
We seem to be happy to use a plain SyntaxError for that, not even
bothering with a subclass. So I'm inclined to agree that TargetScopeError
is not necessary.
--
Greg
__
.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev
better to introduce a new string prefix, e.g.
'v' for 'verbatim':
v"C:\Users\Fred\"
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://ma
er, the backslash prohibition seems to apply even to this
use in f-strings:
>>> f"quote: {ord('\"')}"
File "", line 1
SyntaxError: f-string expression part cannot include a backslash
So it seems that f-strings are even more
Eric V. Smith wrote:
I'm not in any way serious about this. I just want people to realize how
many wacky combinations there would be.
It doesn't matter how many combinations there are, as long as
multiple prefixes combine in the way you would expect, which
they do as far as I can see
If we want a truly raw string format that allows all characters,
including any kind of quote, we could take a tip from Fortran:
s = 31HThis is a "totally raw" string!
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubs
spent more time discussing
it than it will cost to keep it for the rest of Python's
lifetime.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/p
pace. If anything
is to be criticised, it's Intel's decision to only add 4 more
address bits when going from an 8-bit to a 16-bit architecture.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to pyt
n-depth understanding of the issues.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.
e these in Python code.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/arc
exactly matched all the details of the actual
implementation, nor was it intended to. The prose turned out
to be much more readable, anway.:-)
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le
e needs to be a section in the PEP justifying the
choice of PEG over the alternatives.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python
On 3/04/20 10:33 am, Victor Stinner wrote:
I also like the fact that PEG is deterministic, whereas
LL(1) parsers are not.
Where do you get that LL(1) parsers are not deterministic?
That's news to me!
--
Greg
___
Python-Dev mailing list -- pytho
e grammar as a whole still
needs to be unambiguous.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Messag
all of Wirth's languages after Pascal changed the syntax
so as not to have a dangling else problem.)
Personally I would rather my parser generator *did* complain about
ambiguities, so that I can facepalm myself for designing my language
in such a stupid way.
--
Greg
_
king PEG parser
today. :)
Even if the section only says "We didn't consider any alternatives,
because...", I still think it should be there.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to pyt
input and then only being able to say "Something is wrong somewhere
in this file."
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/
individual parsing functions can report
an error, because there might be another branch higher up that
succeeds. Does it keep track of the maximum distance it got through
the source or something like that?
--
Greg
___
Python-Dev mailing list -- python-dev@
qually
powerful.
I'm sure there will be other ways to parse the same language.
That's certainly true now, but can you be sure it will remain
true if additions are made that rely on the full power of PEG?
--
Greg
___
Python-Dev mailing list --
thought of using it as a keyword later".
To reduce arbitrariness, we would either have to make *all*
keywords context-sensitive, or come up with some principled way
of deciding whether a given keyword should be reserved or not.
--
Greg
___
Python-
Another point in favour of always-reserved keywords is that they
make life a lot easier for syntax highlighters.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https
channel with readiness callbacks, you can
implement a buffered channel on top of it.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python
tly most of the time.
Some user-friendly high-level things such as buffered
channels would be provided.
Efficiency is a secondary consideration. If it turns
out to be a problem, that can be addressed later.
--
Greg
___
Python-Dev mailing list -- python
esn't mean it isn't going to
be used in the future, so isn't this wildly wrong?
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/li
ay as well expose it as part of
the official API.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived
ated than that?
You seem to be worried about channels getting leaked if
someone forgets to close them. But it's just the same
for files and pipes, and nobody seems to worry about
that.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To
y the GIL, rather than things like
blocking I/O calls that can release the GIL.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.pytho
ing every extension module that defines its
own Python types and was written before PyType_FromSpec existed.
I expect there is a huge number of those.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev
at close() should do what the
PEP defines release() as doing, and release() shouldn't
exist.
I don't see why an interpreter needs the ability to close
a channel for any *other* interpreter. There is no such
ability for files and pipes.
--
Greg
_
programming in the middle of a
lethal minefield.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message arc
multaneously. Of course
you have to be careful about how you interleave the reads
and writes if you do that.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.o
On 30/04/20 3:29 pm, Raymond Hettinger wrote:
Do you think it is safe to hold a non-reentrant lock across an
arbitrary user function?
I think what's wanted here is to block if it's locked by
a different thread, but raise an exception if it's locked
by the same t
any case, this is a function of the tokeniser, which I
understand isn't being replaced at this stage.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.
ir_fd'):
...
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/
On 16/06/20 12:20 pm, Steven D'Aprano wrote:
The whole point of the REPL is to evaluate an
expression and have the result printed. (That's the P in REPL :-)
Still, it's a bit surprising that it prints results of
expressions within a compound statement, not just at the
top
-- is it possible
to combine '=' and ':=' to match a keyword argument with a sub
pattern and capture the result? I.e. can you write
case Spam(foo = foo_value := Blarg()):
?
--
Greg
Obviously, there are cases where this is
worthwhile, but still.
It may be useful to t
suite by stacking them:
case 401:
case 402:
case 403:
...
Or perhaps both. The stacking option could be useful if the
cases are complicated.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to
he syntax in the PEP
currently allows it to be used that way, but it could do).
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.o
the ``match`` block was entered.
Does that mean the pattern matching logic is in cahoots with
collections.defaultdict? What if you want to match against
your own defaultdict-like type?
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To
ot;ADT" as "Abstract Data Type" and totally
missed that you were using it for something different.
I think it would be better to just call them "algebraic types" (which
is the term I learned) and not use an acronym.
--
Greg
___
Py
art: Point() -> p1, end: Point() -> p2):
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://
ucting the same
object more than one way, but your case would be more persuasive if
you could come up with a side-effect-free example.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python
that it might be using some private feature of
collections.defaultdict to get the specified behaviour. But if it's
only using the standard mapping protocol, I don't think it matters
exactly how it's using it.
--
Greg
___
Python-Dev mailin
ike
Point(x = a)
and decide whether x or a or neither was being assigned to.
Which makes me think there should be something *really*
clear and unambiguous to indicate when assignment is
happening.
--
Greg
___
Python-Dev mailing list -- python-dev@python
On 25/06/20 4:24 pm, Emily Bowman wrote:
There's always making everyone equally annoyed, and allowing 'case
else:'
Visual Basic does actually use "case else". (And "select case"
at the beginning, just to be
3: ...;
end
If we did that in Python it would look like this:
case shape:
Point(x, y):
...
Line(x1, y1, x2, y2):
...
Circle(cx, cy, r):
...
What think folks of this?
--
Greg
___
Python-Dev mailing
he effect of matching anything.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.pytho
would be regarding _ as a "value that matches
anything" rather than a "name that doesn't get assigned to".
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
ht
On 26/06/20 12:31 pm, Brandt Bucher wrote:
I'd imagine that we either find some straightforward way of > opting-in to the
current default behavior
Maybe special-case 'self' in __match_args__ to mean the
object being matched?
--
Greg
matching that works that way. I think
the intention is to leave open the possibility of implementing
it in the future.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https
On 26/06/20 2:10 pm, Gregory P. Smith wrote:
match get_shape() as shape:
case start, end := Line@(shape):
This looks just as inscrutable to me in its own way.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an
confused about overall opinion tallies? one way
to find out...
Maybe there should be a section in each PEP for counter-arguments
that is maintained by another appointed person, independent of the
PEP author and its sponsor. The position could be called "Devil
On 26/06/20 5:45 pm, Ned Deily wrote:
Hasn't "|" been used in a similar way for decades in Unix/POSIX shell patterns,
including with the shell case statement?
Yes, but I regard Unix shell syntaxes as just plain weird
and not a good model for designing a langua
an take a single
argument should be required to implement the corresponding
match behaviour explicitly.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/li
default single-positional-argument deconstruction is probably
a bad idea, because it will be wrong for a large number of
existing classes.)
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-l
t to have one on your shelf, as long as you keep it
to yourself... or something?
You can't have it both ways.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.p
On 2/07/20 4:54 am, Brandt Bucher wrote:
It sounds like you want to add "global z" to the top of the function definition.
Or more likely, change the last case to 'case _'.
--
Greg
___
Python-Dev mailing list -- python-dev@pytho
On 2/07/20 9:25 am, Matthias Bussonnier wrote:
It's still weird user experience as if you swap case .z and case z you don't
get the Unbound error anymore.
It also won't work as intended, because 'case z' will always match
and it will never g
difficult.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/
gh many style guides continue
to describe it as colloquial and less appropriate in formal writing."
Personally I'd go with that and tell any prescriptivists who object
to go and jump in a bitbucket.
--
Greg
___
Python-Dev mailing list -- python
id from English classes. But
French grammar is a lot closer to English than Latin is, so I
don't usually suffer from much confusion. :-)
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le
Maybe the indeterminate use of "he" was influenced by French?
In French there are no neutral pronouns at all, and the masculine
ones are used for indeterminate and mixed genders.
--
Greg
___
Python-Dev mailing list -- python-dev@python
On 4/07/20 4:52 am, Jim J. Jewett wrote:
Specifying British English
"British English" is woefully underspecified -- there are probably more
variants of English used in Britain than in the rest of the world put
together.
--
Greg
___
On 4/07/20 4:33 am, Jim J. Jewett wrote:
If Bob and Alice seem neutral to you, would you do a double-take on Kehinde or
Oladotun?
Maybe we should use randomly generated names for hypothetical persons?
--
Greg
___
Python-Dev mailing list -- python
On 5/07/20 3:26 am, Stephen J. Turnbull wrote:
Greg Ewing writes:
> Maybe we should use randomly generated names for hypothetical
> persons?
Randomly generated according to what character repertoire and lexical
rules (I'm not talking about British v. American)?
Randomly se
oblem.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/pytho
On 5/07/20 8:30 am, MRAB wrote:
On 2020-07-04 21:07, Martin Dengler wrote:
How do you spell "regionalism"?
As far as I'm aware, there's only one way to spell it,
I suppose there could be some planet where it's spelle
you saying that people who split infinitives are usually
black, and the people who look down on them are white? If so,
it would seem that Strunk is actually standing up for black
people here.
(I don't actually believe this has anything to do with race,
I'm just trying *to fully understand*
On 6/07/20 2:56 am, Stephen J. Turnbull wrote:
Thing is, I'm sure I've used Americanisms and even the dreaded
Academic Register, but I sure never noticed them! :-)
Or, in non-American, "surely never noticed them". :-)
--
Greg
__
stead of ".name" as well?
It would work better if ? were used to mark assigned names instead
of values. Then '?' on its own would be a special case of '?name'
where you leave out the name.
--
Greg
___
Python-Dev mailing list --
operator, either = or :=.
The PEP proposes to intermingle them, with only very subtle clues,
such as the presence or absence of dots, to distinguish them.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev
s you
choose names which "look constant-like" somehow.
It also has the general problem of const-declarations in Python.
Currently the compiler only has to analyse one module at a time;
this would require it to also look inside imported modules to
determine whether things were declared
hing different.
Also I don't like the idea of being *forced* to use
a namespace for my constants, regardless of how good an
idea the PEP authors think it is.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to p
case C(x) if x == a.b: ...
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.pyth
On 9/07/20 3:30 am, Luciano Ramalho wrote:
I strongly favor the option of aligning the `else` clause with
`match`, because `else` is a special clause therefore it should look
special.
But on the other hand, it's semantically equivalent to 'case _:',
so it's not all th
e footing semantically, just as they are in
an "if" statement.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org
fault:
...
}
or like this:
switch (x) {
case 1:
...
case 2:
...
default:
...
}
This suggests to me that most people think of the cases as being
subordinate to the switch, and the default being on the same level
as the other cases.
--
Greg
_
On 11/07/20 11:20 pm, Paul Sokolovsky wrote:
On Sat, 11 Jul 2020 22:49:09 +1200
Greg Ewing wrote:
or like this:
switch (x) {
case 1:
...
case 2:
...
default:
...
}
Oh really, you never saw that? Well, they say that any programmer
should
case Point(?x, x):
and it would work as expected.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
On 12/07/20 7:03 am, Federico Salerno wrote:
On 11/07/2020 12:49, Greg Ewing wrote:
switch (x) {
case 1:
...
case 2:
...
default:
...
}
>
I think that last one would be perceived as ok if it weren't for the
brackets: everyone naturally indents an
setup?
Do you have to write
match poly:
pass
case ...
?
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.pytho
Is there anywhere else where Python goes out of its way
to provide two ways of doing the same thing just because
they might feel semantically different?
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-
d the compiler know that it was calling
the builtin locals function and not something else?
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/p
On 13/07/20 3:28 pm, Devin Jeanpierre wrote:
The compiler changes what local variables exist if there is a read from
a variable named 'super',
That's fairly harmless if there's a false positive. But
accidentally getting all your locals de-optimised would b
otentially
change from one match statement to another. I have trouble seeing
this as an improvement over just picking a character to use for
the marking.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python
depends on how non-thread-safe it is. If it's
"weird things can happen" it might be all right. But if
it's "can crash the interpreter" it might not be all right.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
T
On 2/09/20 6:11 pm, Neil Schemenauer wrote:
Weird things would include unexpected exceptions.
I don't mind unexpected exceptions, but I would mind core dumps.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an
r, and the one exposed to Python in the ast module. The only
time the latter should need to change is if there is a change in
the syntax of the language, so why not promise to keep it stable
and use it as the form taken and produced by the macro processors
syntax so that users can keep it in their heads.
Maybe the PEP should propose an AST of its own, which would initially
be a third thing separate from either of the existing ones, with
the possibility of adopting it as the ast module representation
some time in the future.
--
Greg
themselves.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/
array, numpy, etc. -- and you only pay for
the overhead of those if you need them.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.pytho
tp_compare, which also handled all the comparisons, so
tp_richcompare was likely seen as a generalisation of that.
--
Greg
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.
On 15/10/20 1:45 pm, Chris Angelico wrote:
So it'd
be heuristics in the core language that choose a good default for most
situations, and then a str method that returns a preprocessed needle.
Or maybe cache the results of the preprocessing?
--
the moment, then
def f():
v = yield *g()
print v
def g():
yield 42
return "spam"
for x in f():
pass
should end up printing "spam".
Would you entertain the idea of a "yield *" expression
with those semantics?
--
Greg
___
s as coroutines.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
be any conflict.
But if you think there will be a conflict, or that the
similarity would be too confusing, maybe the new
construct should be called something else. I'm
open to suggestions.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
601 - 700 of 2499 matches
Mail list logo