[Python-Dev] Re: Restrict the type of __slots__

2022-03-18 Thread Raymond Hettinger
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. > >

[Python-Dev] Re: Optimizing literal comparisons and contains

2021-11-27 Thread raymond . hettinger
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

[Python-Dev] Re: The list.sort(reverse=True) method not consistent with description

2021-10-30 Thread Raymond Bisdorff
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

[Python-Dev] Re: The list.sort(reverse=True) method not consistent with description

2021-10-30 Thread Raymond Bisdorff
(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

[Python-Dev] The list.sort(reverse=True) method not consistent with description

2021-10-30 Thread Raymond Bisdorff
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)

[Python-Dev] Re: PEP 467 feedback from the Steering Council

2021-09-09 Thread raymond . hettinger
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

[Python-Dev] Re: PEP 467 feedback from the Steering Council

2021-08-10 Thread raymond . hettinger
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

[Python-Dev] Re: Announcing the CPython Docs Workgroup

2021-05-03 Thread Raymond Hettinger
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

[Python-Dev] Re: Announcing the CPython Docs Workgroup

2021-05-01 Thread Raymond Hettinger
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

[Python-Dev] Re: Please do not remove random bits of information from the tutorial

2020-11-09 Thread Raymond Hettinger
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

[Python-Dev] Re: Drop Solaris, OpenSolaris, Illumos and OpenIndiana support in Python

2020-10-30 Thread Raymond Hettinger
> 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. >

[Python-Dev] Re: Drop Solaris, OpenSolaris, Illumos and OpenIndiana support in Python

2020-10-30 Thread Raymond Hettinger
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 --

[Python-Dev] Re: Drop Solaris, OpenSolaris, Illumos and OpenIndiana support in Python

2020-10-30 Thread Raymond Hettinger
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

[Python-Dev] Re: Changing Python's string search algorithms

2020-10-18 Thread Raymond Hettinger
> 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.

[Python-Dev] Re: PEP 620: Hide implementation details from the C API

2020-06-29 Thread Raymond Hettinger
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

[Python-Dev] Re: PEP 620: Hide implementation details from the C API

2020-06-29 Thread Raymond Hettinger
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 ===

[Python-Dev] Re: The Anti-PEP

2020-06-25 Thread Raymond Hettinger
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

[Python-Dev] Re: Latest PEP 554 updates.

2020-05-04 Thread Raymond Hettinger
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

[Python-Dev] Re: Adding a "call_once" decorator to functools

2020-04-30 Thread Raymond Hettinger
> 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.

[Python-Dev] Re: Adding a "call_once" decorator to functools

2020-04-30 Thread raymond . hettinger
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

[Python-Dev] Re: Adding a "call_once" decorator to functools

2020-04-30 Thread Raymond Hettinger
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

[Python-Dev] Re: Adding a "call_once" decorator to functools

2020-04-29 Thread Raymond Hettinger
> 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

[Python-Dev] Re: Adding a "call_once" decorator to functools

2020-04-29 Thread Raymond Hettinger
> 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

[Python-Dev] Re: Adding a "call_once" decorator to functools

2020-04-28 Thread Raymond Hettinger
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()".

[Python-Dev] Re: Accepting PEP 617: New PEG parser for CPython

2020-04-20 Thread Raymond Hettinger
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

[Python-Dev] Re: PEP 616 "String methods to remove prefixes and suffixes" accepted

2020-04-20 Thread Raymond Hettinger
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

[Python-Dev] Re: Improvement to SimpleNamespace

2020-04-15 Thread Raymond Hettinger
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

[Python-Dev] Re: Improvement to SimpleNamespace

2020-04-14 Thread Raymond Hettinger
[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.

[Python-Dev] Improvement to SimpleNamespace

2020-04-14 Thread Raymond Hettinger
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

[Python-Dev] Re: Are PyObject_RichCompareBool shortcuts part of Python or just CPython quirks?

2020-02-03 Thread Raymond Hettinger
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

[Python-Dev] Re: Request to postpone some Python 3.9 incompatible changes to Python 3.10

2020-02-03 Thread Raymond Hettinger
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

[Python-Dev] Re: Are PyObject_RichCompareBool shortcuts part of Python or just CPython quirks?

2020-02-03 Thread Raymond Hettinger
, 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

[Python-Dev] Re: Should set objects maintain insertion order too?

2019-12-15 Thread Raymond Hettinger
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

[Python-Dev] Re: [python-committers] PEP 581/588 RFC: Collecting feedback about GitHub Issues

2019-08-30 Thread Raymond Hettinger
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

[Python-Dev] Re: [python-committers] PEP 581/588 RFC: Collecting feedback about GitHub Issues

2019-08-29 Thread Raymond Hettinger
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

[Python-Dev] Re: Announcing the new Python triage team on GitHub

2019-08-21 Thread Raymond Hettinger
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-

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-07 Thread raymond . hettinger
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

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-07 Thread raymond . hettinger
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 %

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-05 Thread raymond . hettinger
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

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-05 Thread raymond . hettinger
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

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-05 Thread raymond . hettinger
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

[Python-Dev] What to do about invalid escape sequences

2019-08-04 Thread raymond . hettinger
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

[Python-Dev] Re: The order of operands in the comparison

2019-07-21 Thread raymond . hettinger
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

[Python-Dev] Re: What is a public API?

2019-07-13 Thread Raymond Hettinger
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 >>&

Re: [Python-Dev] Adding shlex.join?

2019-04-17 Thread Eric S. Raymond
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 __

Re: [Python-Dev] Is XML serialization output guaranteed to be bytewise identical forever?

2019-03-20 Thread Raymond Hettinger
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

Re: [Python-Dev] Is XML serialization output guaranteed to be bytewise identical forever?

2019-03-20 Thread Raymond Hettinger
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

Re: [Python-Dev] Is XML serialization output guaranteed to be bytewise identical forever?

2019-03-20 Thread Raymond Hettinger
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.

Re: [Python-Dev] Best way to specify docstrings for member objects

2019-03-20 Thread Raymond Hettinger
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

Re: [Python-Dev] Best way to specify docstrings for member objects

2019-03-20 Thread Raymond Hettinger
> 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

Re: [Python-Dev] Best way to specify docstrings for member objects

2019-03-20 Thread Raymond Hettinger
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

Re: [Python-Dev] Best way to specify docstrings for member objects

2019-03-19 Thread Raymond Hettinger
. 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

[Python-Dev] Best way to specify docstrings for member objects

2019-03-19 Thread Raymond Hettinger
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.

Re: [Python-Dev] Is XML serialization output guaranteed to be bytewise identical forever?

2019-03-18 Thread Raymond Hettinger
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

[Python-Dev] Is XML serialization output guaranteed to be bytewise identical forever?

2019-03-18 Thread Raymond Hettinger
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

Re: [Python-Dev] Possible performance regression

2019-02-26 Thread Raymond Hettinger
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

Re: [Python-Dev] Possible performance regression

2019-02-26 Thread Raymond Hettinger
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

Re: [Python-Dev] Compact ordered set

2019-02-26 Thread Raymond Hettinger
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

Re: [Python-Dev] Compact ordered set

2019-02-26 Thread Raymond Hettinger
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: [Python-Dev] Possible performance regression

2019-02-25 Thread Raymond Hettinger
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

Re: [Python-Dev] Possible performance regression

2019-02-25 Thread Raymond Hettinger
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

[Python-Dev] Possible performance regression

2019-02-24 Thread Raymond Hettinger
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

Re: [Python-Dev] Add minimal information with a new issue?

2019-02-21 Thread Raymond Hettinger
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

Re: [Python-Dev] Asking for reversion

2019-02-05 Thread Raymond Hettinger
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

Re: [Python-Dev] Asking for reversion

2019-02-04 Thread Raymond Hettinger
> 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

Re: [Python-Dev] Asking for reversion

2019-02-03 Thread Raymond Hettinger
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/

Re: [Python-Dev] Asking for reversion

2019-02-03 Thread Raymond Hettinger
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 ___

Re: [Python-Dev] Fwd: How about updating OrderedDict in csv and configparser to regular dict?

2019-01-31 Thread Raymond Hettinger
> 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 _

Re: [Python-Dev] How to update namedtuple asdict() to use dict instead of OrderedDict

2019-01-30 Thread Raymond Hettinger
'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

Re: [Python-Dev] How to update namedtuple asdict() to use dict instead of OrderedDict

2019-01-30 Thread Raymond Hettinger
> 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

[Python-Dev] How to update namedtuple asdict() to use dict instead of OrderedDict

2019-01-30 Thread Raymond Hettinger
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

Re: [Python-Dev] Lost sight

2019-01-20 Thread Raymond Hettinger
> 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

[Python-Dev] General concerns about C API changes

2018-11-13 Thread Raymond Hettinger
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

Re: [Python-Dev] Postponed annotations break inspection of dataclasses

2018-09-23 Thread Raymond Hettinger
__(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

Re: [Python-Dev] Testing C API

2018-07-30 Thread Raymond Hettinger
> 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

Re: [Python-Dev] Testing C API

2018-07-29 Thread Raymond Hettinger
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

Re: [Python-Dev] [issue34221] Any plans to combine collections.OrderedDict with dict

2018-07-26 Thread Raymond Hettinger
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', '

Re: [Python-Dev] [issue34221] Any plans to combine collections.OrderedDict with dict

2018-07-25 Thread Raymond Hettinger
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

Re: [Python-Dev] Add __reversed__ methods for dict

2018-05-26 Thread Raymond Hettinger
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 (

Re: [Python-Dev] PEP 574 (pickle 5) implementation and backport available

2018-05-25 Thread Raymond Hettinger
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 ___

Re: [Python-Dev] Add __reversed__ methods for dict

2018-05-25 Thread Raymond Hettinger
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

Re: [Python-Dev] Hashes in Python3.5 for tuples and frozensets

2018-05-16 Thread Raymond Hettinger
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-

Re: [Python-Dev] (Looking for) A Retrospective on the Move to Python 3

2018-05-12 Thread Eric S. Raymond
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

Re: [Python-Dev] PEP 572: Usage of assignment expressions in C

2018-04-30 Thread Raymond Hettinger
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 __

Re: [Python-Dev] PEP 572: A backward step in readability

2018-04-30 Thread Raymond Hettinger
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

Re: [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20

2018-04-25 Thread Raymond Hettinger
> 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

Re: [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20

2018-04-25 Thread Raymond Hettinger
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

Re: [Python-Dev] PEP 575: Unifying function/method classes

2018-04-15 Thread Raymond Hettinger
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 ___

Re: [Python-Dev] PEP 575: Unifying function/method classes

2018-04-13 Thread Raymond Hettinger
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

Re: [Python-Dev] Soliciting comments on the future of the cmd module (bpo-33233)

2018-04-06 Thread Raymond Hettinger
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:

Re: [Python-Dev] Replacing self.__dict__ in __init__

2018-03-25 Thread Raymond Hettinger
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

Re: [Python-Dev] Replacing self.__dict__ in __init__

2018-03-24 Thread Raymond Hettinger
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

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-13 Thread Raymond Hettinger
> 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 > >

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-13 Thread Raymond Hettinger
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 ___

Re: [Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Raymond Hettinger
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

[Python-Dev] Symmetry arguments for API expansion

2018-03-12 Thread Raymond Hettinger
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

[Python-Dev] Should the dataclass frozen property apply to subclasses?

2018-02-21 Thread Raymond Hettinger
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(

Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-20 Thread Raymond Hettinger
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

Re: [Python-Dev] Is static typing still optional?

2018-01-29 Thread Raymond Hettinger
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

Re: [Python-Dev] Is static typing still optional?

2018-01-28 Thread Raymond Hettinger
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   2   3   4   5   6   7   8   9   10   >