sed, but I'm hoping it will catch on (just
like people are slowly growing more aware that they can add docstringa to
fields in named tuples).
Raymond
On Fri, Mar 18, 2022 at 4:33 AM Serhiy Storchaka
wrote:
> Currently __slots__ can be either string or an iterable of strings.
>
>
For the benefit of the audience on python-dev, you should also mention that
this proposal and associated PR has been twice discussed and rejected on the
tracker:
https://bugs.python.org/issue45907
https://bugs.python.org/issue45843
The response just given by Skip pretty much matches the c
Dear All,
You are all completely right.
Sorry for the confusion.
Thank you all very much for putting my mind right about this issue.
Best Regards
Raymond Bisdorff
> On 30 Oct 2021, at 19:00, Tim Peters wrote:
>
> [Raymond Bisdorff ]
>> I fully agree with your point. By d
(2, 'd'), (3, 'e')]
>>> L.sort(key=itemgetter(0), reverse=True)
>>> L = [(3, 'e'), (2, 'd'), (2, 'b'), (1, 'c'), (1, 'a')]
Should the tuples comparison is in this case, I thought, not be solely
based on the first tup
Dear Python developers,
The help(list) shows in a python console the following documentation
string for the list.sort() method.
sort(self, /, *, key=None, reverse=False)
| Sort the list in ascending order and return None.
|
| The sort is in-place (i.e. the list itself is modified)
mber of use cases also matters. The bar for adding a new builtin
function is very high.
Raymond
___
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
I recommend removing the "discouragement" from writing "bytes(10)". That is
merely stylistic. As long as we support the API, it is valid Python. In the
contexts where it is currently used, it tends to be clear about what it is
doing: buffer = bytearray(bufsize). That doesn't need to be disco
initial group
excludes our most active documentation contributors and includes people who
have only minimal contributions to existing documentation and mostly have not
participated in any documentation reviews on the issue tracker. Did the SC
approve all the initial members?
Raymond
Please add me to the list of members for the initial workgroup.
Thank you,
Raymond
___
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
easy, then let's just
rename it to "Language walk-through with examples" or some such.
* FWIW, I've closely monitored the bug tracker daily for almost two decades.
We almost never get a user complaint that the tutorial is too advanced. For
the most part, it has long been of
> On Oct 30, 2020, at 4:51 PM, Gregory P. Smith wrote:
>
> On Fri, Oct 30, 2020 at 1:14 PM Raymond Hettinger
> wrote:
> FWIW, when the tracker issue landed with a PR, I became concerned that it
> would be applied without further discussion and without consulting users.
>
nvest
resources either in the form of developers or dollars to keep the port alive we
will. By we I mean RackTop and/or Staysail Systems." --
https://twitter.com/gedamore/status/1321959956199866369
Raymond
___
Python-Dev mailing list --
s day." -- abarbu
* ... and many more will the same flavor
Given this kind of user response, I think it would irresponsible to drop
support.
Raymond
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to p
> On Oct 17, 2020, at 2:40 PM, Tim Peters wrote:
>
> Still waiting for someone who thinks string search speed is critical
> in their real app to give it a try. In the absence of that, I endorse
> merging this.
Be bold. Merge it.
ere is a certain irony in making repeated, unsubstantiated promises to make
the language 2x faster and then checking in changes that make the
implementation slower.
Raymond
P.S. What PyPy achieved was monumental. But it took a decade even with a
well-organized and partially-funded team of
Most of the work is being done
by one person. Many of the PRs aren't reviewed. The rate and volume of PRs are
so high that almost no one can keep track of what is happening. Mark and Stefan
have pushed back but with no effect.
Raymond
===
s.
The current process doesn't make it likely that a balanced document is created
for decision making purposes.
Raymond
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://m
n, tenacity, team play, and overcoming adversity.
May your sub-interpreters be plentiful,
Raymond
___
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/pyth
> On Apr 30, 2020, at 10:44 AM, Carl Meyer wrote:
>
> On Wed, Apr 29, 2020 at 9:36 PM Raymond Hettinger
> wrote:
>> Do you have some concrete examples we could look at? I'm having trouble
>> visualizing any real use cases and none have been presented so far.
Would either of the existing solutions work for you?
class X:
def __init__(self, name):
self.name = name
@cached_property
def title(self):
print("compute title once")
return self.name.title()
@property
@lru_cache
def upper(self):
print("compute u
nce() to block and await a
result are wasted.
4) It would be inconsequential if this function were called twice.
5) A more common way to do this is to move the test into the lookup() function
-- see below.
Raymond
-
CHAR_BASE = {}
def _init_chars():
for code in range
> On Apr 29, 2020, at 4:20 PM, Antoine Pitrou wrote:
>
> On Wed, 29 Apr 2020 12:01:24 -0700
> Raymond Hettinger wrote:
>>
>> The call_once() decorator would need different logic:
>>
>> 1) if the function has already been called and result is known, retur
> On Apr 29, 2020, at 12:55 AM, Tom Forbes wrote:
>
> Hey Raymond,
> Thanks for your input here! A new method wouldn’t be worth adding purely for
> performance reasons then, but there is still an issue around semantics and
> locking.
Right.
> it doesn’t actually e
just makes a single dict lookup and returns the
value.¹ The lru_cache_make_key() function just increments the empty args tuple
and returns it.² And because it is a C object, calling it will be faster than
for a Python function that just returns a constant, "lambda: some_constant()".
This will be a nice improvement.
Raymond
___
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
hich sometimes cause mental hiccups
initially being read as if-ilter and is-lice.
Raymond
___
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.pyt
lso, it still leaves you with
using setattr(ns, attrname, attrvalue) or tricks with vars() when doing
updates. The AttrDict recipe is popular for a reason.
Raymond
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to pyt
[GvR]
> We should not try to import JavaScript's object model into Python.
Yes, I get that. Just want to point-out that working with heavily nested
dictionaries (typical for JSON) is no fun with square brackets and quotation
marks.
rything SimpleNamespace already does just so we
can add some supporting dunder methods. Please add more commentary so we can
figure-out the best way to offer this powerful functionality.
Raymond
___
Python-Dev mailing list -- python-dev@pyth
the identity-implies-equality
step currently in PyObject_RichCompareBool(). It isn't just an optimization,
it is necessary for writing correct application code without tricks such at the
"if x == x: ..." test.
Raymond
___
Python-Dev maili
users by deferring them for
another release.
Raymond
___
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
http
, but sorted() and min()
are allowed to assume a meaningful total ordering (which might or might not be
true). In other words, containers and functions are allowed, when necessary or
useful, to override the decisions made by their data. This seems like a
reasonable state of affairs.
The current
ble that
it will be suggested periodically because it is such an obvious thing to
consider.
Raymond
___
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-de
are anonymous or have pseudonyms. Am not sure
how those can be migrated, we know very little about the participant except for
their recurring posts.
Raymond
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-d
e tracker.
I have high hopes for the success of the migration but success isn't a given.
Raymond
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mai
n a "triager" and a "core
developer" is the ability to push the "commit" button. In a way, that is the
least interesting part of the process and is often a foregone conclusion by the
time it happens.
Raymond
___
Python-
This isn't about me. As a heavy user of the 3.8 beta, I'm just the canary in
the coal mine.
After many encounters with these warnings, I'm starting to believe that
Python's long-standing behavior was convenient for users. Effectively, "\-"
wasn't an error, it was just a way of writing "\-". F
For me, these warnings are continuing to arise almost daily. See two recent
examples below. In both cases, the code previously had always worked without
complaint.
- Example from yesterday's class
''' How old-style formatting works with positional placeholders
print('The answer is %
End-user experience isn't something that can just be argued away. Steve and I
are reporting a recurring annoyance. The point of a beta release is to elicit
these kinds of reports so they can be addressed before it is too late. ISTM
you are choosing not to believe the early feedback and don't
in their filename.
Yes, I've seen that as well.
Unfortunately, the syntax warning or error doesn't detect that case. It only
complains about invalid sequences which weren't the actual problem we were
trying to solve. The new warning soon-to-be error breaks code that currently
Thanks for looking at other languages do. It gives some hope that this won't
end-up being a usability fiasco.
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailm
on how you use Python, this
may not affect you or it may arise multiple times per day.
Raymond
P.S. Before responding, it would be a useful exercise to think for a moment
about whether you remember exactly which characters must be escaped or whether
you habitually put in an extra backsl
FWIW, the bisect_left and bisect_right functions have different argument order
so that they can both use __lt__, making them consistent with sorting and with
the heapq functions.
Raymond
___
Python-Dev mailing list -- python-dev@python.org
To
s mostly worked out fine and didn't require a strict rule for all
modules everywhere. IMO, there is no need to sweep through the library and
change long-standing policies on existing modules.
Raymond
--
>>> import calendar
>>&
who took the responsibility to review it.
That would be *you.*
So my advice is: pull the trigger. Get forgiveness if it turns out you need
it. I don't expect you will.
--
http://www.catb.org/~esr/";>Eric S. Raymond
signature.asc
Description: PGP signature
__
n. It's up to you all to do the right
thing.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
ML tools in other languages (such as Java) don't sort
(and likely for good reason). LXML is dropping its attribute sorting as well,
so the standard library would become more of an outlier.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
27;s recipe for reordering attributes
* make a semantic level comparison
Will any other these work for you?
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.
special -- they just make regular classes,
similar to or better than you would write by hand.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailma
> definition have no access to the class object.
> Logically speaking, a definition item should be able to see everything that
> is defined before it.
The member objects get created downstream by the type() metaclass. So, there
isn't a vi
om the standard library),
the help() is clearly better with the annotations than without.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
. But then, you never can
tell ;-)
Raymond
"Difficult to see. Always in motion is the future." -- Master Yoda
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail
worked out examples below. What do you all think about the
proposal?
Raymond
¹ https://bugs.python.org/issue36326
== Desired help() output ==
>>> help(NormalDist)
Help on class NormalDist in module __main__:
class NormalDist(builtins.object)
| NormalDist(mu=0.0, sigma=1.
uld it make sense as an option?
Time machine! Stéphane Wirtel just posted a basic semantic comparison between
two streams.¹ Presumably, there would need to be a range of options for
specifying what constitutes equivalence but this is a nice start.
Raymond
¹ https://bugs.python.org
n
standard library modules guarantee cross-release bytewise identical output for
XML. That is really the core issue here. Had we had an explicit notice one way
or the other, there wouldn't be an issue now.
Any thoughts?
Raymond Hettinger
P.S. Stefan Behnel is planning to remove
ed it
out of a local minimum and that performance will return the next time someone
touches the eval-loop.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
htt
ad based.
That said, it seems to be compiler specific and only affects the Mac builds, so
maybe we can decide that we don't care.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Uns
o consider this when bumping the load factor down to 60%,
prioritizing speed over space.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/option
temper the enthusiasm with
rationality and caution. The existing setobject code has been finely tuned and
micro-optimized over the years, giving it excellent performance on workloads we
care about. It would be easy throw all of that away.
Raymond
__
re to try to solicit
independent confirmation.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
read_local
> 19.4 ns read_nonlocal
These timings are several times larger than they should be. Perhaps you're
running a debug build? Or perhaps 32-bit? Or on VM or some such. Something
looks way off because I'm getting 4 and 5 ns on my 2013 Haswell laptop.
Raymond
today), so I'm hoping other folks can run
checks as well.
Raymond
-- Yesterday
$ ./python.exe Tools/scripts/var_access_benchmark.py
Variable and attribute read access:
4.0 ns read_local
4.5 ns
anything that raises the cost of filing a bug report will work to
our detriment. Ideally, we want the barriers to reporting to be as low as
possible.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/p
uld
really use some help and support from everyone on the team.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
> On Feb 4, 2019, at 2:36 AM, Łukasz Langa wrote:
>
> @Raymond, would you be willing to work with Davin on finishing this work in
> time for alpha2?
I would be happy to help, but this is beyond my technical ability. The people
who are qualified to work on this have already chim
ple disadvantage (the cost of moving data between
processes). It's something we really want.
But let's see what the 3.8 release manager has to say.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/
maintainers
for multiprocessing even though that is what he's been working on for the last
two years and at the last two sprints. I'd like to see more team work here
rather than applying social pressures via python-dev (which is a *very* public
list).
Raymond
___
> On Jan 31, 2019, at 3:06 AM, Steve Holden wrote:
>
> And I see that such a patch is now merged. Thanks, Raymond!
And thank you for getting ordering into csv.DictReader. That was a significant
improvement in usability :-)
Raymond
_
'm really just aiming for something as simple as s/OrderedDict/dict in
namedtuple :-)
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
> On Jan 30, 2019, at 6:00 PM, David Mertz wrote:
>
> Ditto +1 option 4
>
> On Wed, Jan 30, 2019, 5:56 PM Paul Moore On Wed, 30 Jan 2019 at 22:35, Raymond Hettinger
> wrote:
> > My recommendation is Option 4 as being less disruptive and more beneficial
> > t
rrently depending on
the reordering methods for the output of _asdict(), the remediation is
trivially simple: nt._asdict() -> OrderedDict(nt.as_dict()).
What do you all think?
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
htt
> On Jan 19, 2019, at 2:12 AM, Serhiy Storchaka wrote:
>
> I have virtually completely lost the sight of my right eye (and the loss is
> quickly progresses) and the sight of my left eye is weak.
I hope this only temporary. Best wishe
project with many PRs going directly into master, so it does
warrant having buy in that the churn isn't destabilizing and will actually
produce a benefit that is worth it.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http
__(self, key, value):
print(f'{key!r}: {value!r}')
>>> exec('a=b', globals(), M())
'a': 'B'
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
> On Jul 30, 2018, at 12:06 AM, Serhiy Storchaka wrote:
>
> 30.07.18 09:46, Raymond Hettinger пише:
>> I prefer the current organization that keeps the various tests together with
>> the category being tested. I almost never need to run the C API tests all
>> at
intaining something like marshal, it would be easy to miss some of the tests
if they are in a separate file. IMO, the proposed change would hinder future
maintenance and fly in the face of our traditional code organization.
Raymond
___
Python-Dev
s compatible with older Pythons.
The proposed repr does look pretty but probably isn't worth the disruption.
Raymond
--
$ python3.7 -m timeit -r 7 'from collections import OrderedDict'
"OrderedDict([('a', '1'), ('b', '
id, now that regular dicts are ordered by default, the need for
collections.OrderedDict() should diminish quite a bit. Mostly, I think people
will ignore OrderedDict unless their application heavily exercises move to end
operations.
Raymond
___
Python-Dev mai
easily iterate in reverse?
It really doesn't matter whether an implementer uses a dense array of keys or a
doubly-linked-list; either way, looping backward is as easy as going forward.
Raymond
P.S. It isn't going to be hard to update MicroPython to have a compact and
ordered dict (
proportional to size, so
compression is likely to be a net win (much as it was for header compression in
HTTP/2).
The PEP lists compression as a possible a refinement only for large objects,
but I expect is will be a win for most pickles to compress them in their
entirety.
Raymond
___
ould be nice for __reversed__ to already be
supported so that people won't be tempted to implement an ugly workaround using
popitem() calls followed by reinsertions.
Raymond
.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.pytho
e that integers hash to themselves.
That is very fast to compute :-) Also, it tends to prevent hash collisions for
consecutive integers.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-
fall off the radar.
--
http://www.catb.org/~esr/";>Eric S. Raymond
My work is funded by the Internet Civil Engineering Institute: https://icei.org
Please visit their site and donate: the civilization you save might be your own.
___
Python-D
le reading, do something
> }
Thanks Antoine, this is an important point that I hope doesn't get lost.
In a language with exceptions, assignment expressions are less needful.
Also, the pattern of having of having mutating methods return None
further limits the utility.
Raymond
__
orical trick for dismissing a bunch of
thoughtful posts.
Adding this new syntax is a one-way trip -- we don't get to express
regrets later. Accordingly, it would be nice if the various concerns
being presented were addressed directly rather than being
dismissed with a turn of p
> On Apr 26, 2018, at 12:40 AM, Tim Peters wrote:
>
> [Raymond Hettinger ]
>> After re-reading all the proposed code samples, I believe that
>> adopting the PEP will make the language harder to teach to people
>> who are not already software engineers.
>
> C
less appealing. The proposal
also messes with my mental model for the distinction between
expressions and statements.
It probably doesn't matter at this point (minds already seem to be made up),
but put me down for -1. This is a proposal we can all easily live without.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
27;s usually pretty easy to fix.
I don't think that confidence is warranted. The world of Python is very large.
When public APIs (such as that in the venerable types module) get changed, is
virtually assured that some code will break.
Raymond
___
ld, code that would be broken if the distinction is
lost.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
d I think it still serves a useful
purpose. So, unless it is considered broken, I don't think it should be
deprecated.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
On Mar 25, 2018, at 8:08 AM, Tin Tvrtković wrote:
>
> That's reassuring, thanks.
I misspoke. The object size is the same but the underlying dictionary loses
key-sharing and doubles in size.
Raymond
___
Python-Dev mailing list
Python-Dev
et benefits of
key-sharing. That benefit is lost only when the instance dict keys are
modified downstream from __init__(). So, from a dict size point of view, your
optimization is fine.
Still, you should look at whether this would affect static type checkers, lint
tools, and other tooling.
R
> On Mar 13, 2018, at 12:07 PM, Guido van Rossum wrote:
>
> OK, please make it so.
Will do. I'll create a tracker issue right away.
Since this one looks easy (as many things do at first), I would like to assign
it to Nofar Schnider (one of my mentees).
Raymond
>
>
ts rather than letting you decompose to more
more basic types. It's nice to have a way to move down the chain from ℚ, ℝ, or
ℂ to the more basic ℤ (of course, that only works because floats and complex
are implemented in a way that precludes exact irrationals).
Raymond
___
is_integer()
> So I think the OP of the bug has a valid point, 27 years without this feature
> notwithstanding.
Okay, I'll ask the OP to update his patch :-)
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
rtunity to decline. That said, proponents of symmetry requests tend to
feel strongly about it and tend to never fully accept such a request being
declined (it leaves them with a sense that Python is disordered and unbalanced).
Raymond
My thoughts on the feature request -
What is the propo
e):
pass
>>> t = T([10, 20, 30])
>>> t.cached = True
>>> class F(frozenset):
pass
>>> f = F([10, 20, 30])
>>> f.cached = True
>>> class B(bytes):
pass
>>> b = B(
inheriting
> from tuple, and it should just be solved right, somehow.)
Perhaps a new variant of __init_subclass__ would work.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-de
I
recommend putting various correct and incorrect examples in front of other
users (preferably experienced Python programmers) and asking them to predict
what the code does based on the source code.
Raymond
___
Python-Dev mailing list
Pytho
m dataclasses import dataclass
>>> @dataclass(hash=False)
class A:
x: int
>>> hash(A(1))
285969507
I'm hoping that this part of the API gets thought through before it gets set in
stone. Since dataclasses code never got a chance to live in the wild (on PyPI
or some
1 - 100 of 1495 matches
Mail list logo