[Python-ideas] Re: frozen dataclasses attribute initialization

2019-12-11 Thread Andrew Barnert via Python-ideas
; possible to dynamically define the __setattr__ method in the end of the > __post_init__ call. __setattr__, like most special methods, has to appear on the class, not the instance. So you can’t dynamically redefine it. (Plus, even if you could, it would again add 8 bytes to every instance.) _

[Python-ideas] Re: Python slicing

2019-12-12 Thread Andrew Barnert via Python-ideas
____ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/WIL

[Python-ideas] Re: Python slicing

2019-12-12 Thread Andrew Barnert via Python-ideas
re probably better off explicitly using index arrays and bool arrays as your indexes, as numpy does. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.pytho

[Python-ideas] Re: Python slicing

2019-12-12 Thread Andrew Barnert via Python-ideas
ct [] to be anything other than [()], or find it confusing? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://ma

[Python-ideas] Re: Argumenting in favor of first()

2019-12-12 Thread Andrew Barnert via Python-ideas
es into > itertools.) The docs for more_itertools.first say it’s equivalent to next of iter, which makes the behavior even more obvious to anyone who understands iteration in Python, even if they’ve never used itertools before. _______ Python-idea

[Python-ideas] Re: Python slicing

2019-12-12 Thread Andrew Barnert via Python-ideas
at, or anything else relevant) just because you changed subscripting. So t would be the first argument, the same as always. If you want 1 to be the first argument, you have to write MyWeirdTuple(*t). _______ Python-ideas mailing list -- python-ideas@pyt

[Python-ideas] Re: Python slicing

2019-12-12 Thread Andrew Barnert via Python-ideas
pam”? It’s a range you can use to slice a sorteddict, but if you try to iterate it or contains it you get a ValueError.) Now we’ve got something as convenient to use as Python, and more convenient for people implementing sequence and mapping types (no more “if it’s a tuple do this, else do that

[Python-ideas] Re: Python slicing

2019-12-12 Thread Andrew Barnert via Python-ideas
ents. You can say all zero of the dimensions are any number you like, and you get that number to the zeroth power elements, which is always 1. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-le...@py

[Python-ideas] Re: Argumenting in favor of first()

2019-12-12 Thread Andrew Barnert via Python-ideas
bout the building blocks of an algebra for iterators that you can compose into powerful tools? ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/p

[Python-ideas] Re: Argumenting in favor of first()

2019-12-12 Thread Andrew Barnert via Python-ideas
’s so easy for someone to derail a thread that’s making progress just by raising a spurious problem. People jump to trying to come up with the best solution without asking whether the problem actually needs to be solved. ___ Python-ideas mailing list --

[Python-ideas] Re: Argumenting in favor of first()

2019-12-14 Thread Andrew Barnert via Python-ideas
learn about iterators. There are certainly a lot of StackOverflow dups asking why `for line in file:` gives them no lines when just 10 lines earlier the same file had 20 lines. ___ Python-ideas mailing list -- [email protected] To unsubscribe send

[Python-ideas] Re: Add "elif" to "for_stmt" and "while_stmt"

2019-12-15 Thread Andrew Barnert via Python-ideas
ght be useful; maybe it’s even come up for me a few times. But if the motivating examples are cases where it would make the code less readable rather than more, that’s not a good sign. _______ Python-ideas mailing list -- [email protected] To unsu

[Python-ideas] Re: Argumenting in favor of first()

2019-12-15 Thread Andrew Barnert via Python-ideas
t it Looking at my own REPL history and pile of throwaway scripts, dicts actually seem to make up a lot of my own uses of more_itertools.first. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected]

[Python-ideas] Re: Add symlinks option at shutil.move parameters

2019-12-18 Thread Andrew Barnert via Python-ideas
r is. Does GNU or BSD mv provide an option for what you want? What’s your use case for wanting to do this? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org

[Python-ideas] Re: "and if" and "or if" for trailing if statements - including explicit fallthrough

2019-12-21 Thread Andrew Barnert via Python-ideas
ust have some case where you really wanted this, that motivated you to propose it? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas

[Python-ideas] Re: "and if" and "or if" for trailing if statements - including explicit fallthrough

2019-12-21 Thread Andrew Barnert via Python-ideas
lly reads the same. A fallthrough says “tail call does this stuff, and then does the stuff from the next (call) case”. An orif says “call, or also tail call which did some other stuff, does this stuff.” It seems backward to think of it that way. _______ Python-ideas

[Python-ideas] Re: Throw a TypeError exception if using type annotations (type hints) & the passed arg or return value is the wrong type

2019-12-24 Thread Andrew Barnert via Python-ideas
dynamic type systems. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archi

[Python-ideas] Re: Moving PEP 584 forward (dict + and += operators)

2019-12-25 Thread Andrew Barnert via Python-ideas
On Dec 25, 2019, at 14:57, python-ideas--- via Python-ideas wrote: First, as a side note, you seem to have configured your python-ideas-posting address with the name “python-ideas” rather than with a name that can be used to distinguish you from other people. This will make conversations

[Python-ideas] Re: Moving PEP 584 forward (dict + and += operators)

2019-12-26 Thread Marco Sulla via Python-ideas
ogenerated a "real name" from the part of your email address before > the at sign (the "mailbox" portion). If you set an actual name, it'll > come through more readably to everyone else. More simply, I'm posting from mail.python.org site, and I had not set name and surname in profile. ___

[Python-ideas] Re: Moving PEP 584 forward (dict + and += operators)

2019-12-26 Thread Marco Sulla via Python-ideas
imply try to proof it to me the contrary. I can change my mind, I'm not a member of Daesh. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lis

[Python-ideas] Re: AVG Function as Built-in

2019-12-26 Thread Marco Sulla via Python-ideas
So why only mean and not median, that's better for statistics? :D Seriously, if you want it builtin, add it to PYTHONSTARTUP: https://docs.python.org/3/using/cmdline.html#envvar-PYTHONSTARTUP from statistics import mean ___ Python-ideas ma

[Python-ideas] Re: AVG Function as Built-in

2019-12-26 Thread Marco Sulla via Python-ideas
09] on linux Type "help", "copyright", "credits" or "license" for more information. >>> sum([1e16,1,1])/3 3333.5 ___ Python-ideas mailing list -- [email protected] To unsubscribe send an

[Python-ideas] Re: Moving PEP 584 forward (dict + and += operators)

2019-12-26 Thread Marco Sulla via Python-ideas
.and? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@py

[Python-ideas] Re: Fix statistics.median()?

2019-12-26 Thread Marco Sulla via Python-ideas
e of the two central values is NaN, the other value is returned. The function returns NaN only if both are NaNs. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.py

[Python-ideas] Re: Moving PEP 584 forward (dict + and += operators)

2019-12-26 Thread Andrew Barnert via Python-ideas
> On Dec 26, 2019, at 04:15, Marco Sulla via Python-ideas > wrote: > > Mathematically, Whenever someone tries to argue that “Mathematically, this doesn’t make sense” it ends up isomorphic to an argument that they really would have enjoyed one more semester of math classes as an u

[Python-ideas] Re: AVG Function as Built-in

2019-12-26 Thread Andrew Barnert via Python-ideas
’t need anything else from stats (or numpy). Whatever. But you have to make that argument; otherwise, stats.mean seems like the right place for it, just like functools.partial and math.sin. _______ Python-ideas mailing list -- [email protected] T

[Python-ideas] Re: Fix statistics.median()?

2019-12-26 Thread Andrew Barnert via Python-ideas
easily just from math itself. Or, once you can get infinite values, you can easily get nan values with just basic arithmetic: >>> 1e1000 - 1e1000 nan _______ Python-ideas mailing list -- [email protected] To unsubscribe s

[Python-ideas] Re: Moving PEP 584 forward (dict + and += operators)

2019-12-26 Thread Marco Sulla via Python-ideas
t, I **kindly** hope that set will be not taken as example for future APIs. I **strongly** hope that the good, old, plus operator will be chosen, because, as I wrote, **mathematically** has more sense, for sets, dicts and whatever object needs to be merged to another one. Peace and love.

[Python-ideas] Re: Fix statistics.median()?

2019-12-26 Thread Marco Sulla via Python-ideas
the biased median_high() and median_low() functions of `statistics`. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.o

[Python-ideas] Re: Moving PEP 584 forward (dict + and += operators)

2019-12-26 Thread Andrew Barnert via Python-ideas
y noticed the happy accident that the three happen to be essentially the same, but since they borrowed more symbols from Schröder it’s probably the sideways U that’s the direct ancestor of our modern symbol. ___________ Python-ideas mailing list -- python-idea

[Python-ideas] Re: Fix statistics.median()?

2019-12-26 Thread Marco Sulla via Python-ideas
lice the NaNs away more easily, if (s)he wants :) I think Java do the things this way, because I tested `Collections.sort()` with a List and it puts all NaNs at the end of the list. _______ Python-ideas mailing list -- [email protected] To unsubscribe

[Python-ideas] Re: Moving PEP 584 forward (dict + and += operators)

2019-12-26 Thread Marco Sulla via Python-ideas
could at least separate this discussion in a separate thread. Can you, please? Thanks in advance. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/

[Python-ideas] Re: Moving PEP 584 forward (dict + and += operators)

2019-12-26 Thread Andrew Barnert via Python-ideas
> On Dec 26, 2019, at 11:32, Marco Sulla via Python-ideas > wrote: > > Andrew Barnert wrote: >>> the operator is ⊂. "<" operator is used for >>> comparison, and it's vital for sorting. >> Yes. It’s the defining operation for the partial

[Python-ideas] Re: Moving PEP 584 forward (dict + and += operators)

2019-12-26 Thread Marco Sulla via Python-ideas
; sorted(a) [set(), {2}, {3, 7}, {1}, {1, 4}, {10}, {3}, {10, 3, 7}, {1, 4}] ``` Notice the positions of the two {1, 4} sets.. SOo sorted(sets) does **not** sort at all. Total, partial, so and so, nothing. Can we now stop please this OT and return to the thread? __

[Python-ideas] Re: Fix statistics.median()?

2019-12-26 Thread Marco Sulla via Python-ideas
David Mertz wrote: > Here is an implementation that: > A. Only relies on '<' Well, no. There's an `==` check. Can you please read this 2 posts of mine? https://mail.python.org/archives/list/[email protected]/message/7255SH6LSC266HAGI4SRJGV4JTUMMI4J/ https://mail.

[Python-ideas] Re: Fix statistics.median()?

2019-12-26 Thread Andrew Barnert via Python-ideas
On Dec 26, 2019, at 12:19, Marco Sulla via Python-ideas wrote: > > IMHO, another sorted function, slower than it, should be added. You can very easily just write a key function that does this for you. In fact, you can write different key functions for different variations. For examp

[Python-ideas] Re: Fix statistics.median()?

2019-12-26 Thread Andrew Barnert via Python-ideas
On Dec 26, 2019, at 12:36, Richard Damon wrote: > > On 12/26/19 2:10 PM, Andrew Barnert via Python-ideas wrote: >>> On Dec 26, 2019, at 10:58, Richard Damon wrote: >>> Note, that NaN values are somewhat rare in most programs, I think they can >>> only come ab

[Python-ideas] Re: Fix statistics.median()?

2019-12-26 Thread Andrew Barnert via Python-ideas
On Dec 26, 2019, at 14:13, Chris Angelico wrote: > > On Fri, Dec 27, 2019 at 9:07 AM Andrew Barnert via Python-ideas > wrote: >> >> You can very easily just write a key function that does this for you. In >> fact, you can write different key functions for diffe

[Python-ideas] Re: Moving PEP 584 forward (dict + and += operators)

2019-12-26 Thread Marco Sulla via Python-ideas
t could be also negative, so it's sign is meaningless (except for total ordering). And the result is wrong... but I repeat, who cares? :D _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-le...@python.

[Python-ideas] Re: Fix statistics.median()?

2019-12-26 Thread Marco Sulla via Python-ideas
Andrew Barnert wrote: > On Dec 26, 2019, at 12:19, Marco Sulla via Python-ideas > [email protected] wrote: > you can get the behavior of your algorithm below: > @functools.cmp_to_key > def flip_incomparables_key(a, b): > if a < b: return -1 > if b <

[Python-ideas] Re: Moving PEP 584 forward (dict + and += operators)

2019-12-26 Thread Andrew Barnert via Python-ideas
> On Dec 26, 2019, at 14:46, Marco Sulla via Python-ideas > wrote: > > David Mertz wrote: >> NaN is an IEEE-854 value, everything you >> mention is precisely identical of floats. >> Is your argument that we need to stop using the '<' operator f

[Python-ideas] Re: Fix statistics.median()?

2019-12-26 Thread Andrew Barnert via Python-ideas
On Dec 26, 2019, at 15:27, Marco Sulla via Python-ideas wrote: > > Andrew Barnert wrote: >> On Dec 26, 2019, at 12:19, Marco Sulla via Python-ideas >> [email protected] wrote: >> you can get the behavior of your algorithm below: >> @functools.cmp_to_key &

[Python-ideas] Re: Fix statistics.median()?

2019-12-26 Thread Marco Sulla via Python-ideas
= float("nan") print(sorted([x, 6, -10, float("-inf"), 1981, 8, y, float("+inf"), 19, 23], key=iliadSort)) ``` result: ``` [-inf, -10, 6, 8, 19, 23, 1981, inf, nan, nan] ``` but works only for NaNs and requires also "=="... 0_____o ____

[Python-ideas] `set` API and various sorting problems

2019-12-26 Thread Marco Sulla via Python-ideas
eError > > pass > > > > return x > > > But this isn’t the same thing that IEEE totalOrder defines. I clearly stated that the key function total_order() is being developed, that there's a bug opened by Tim Peters and that what I wrote has nothing to do w

[Python-ideas] Re: Fix statistics.median()?

2019-12-26 Thread Marco Sulla via Python-ideas
iliadSort(a, b): if a < b: res = -1 elif not b == b: res = -1 else: res = 0 return res and NaNs are moved at the end of the list. ___________ Python-ideas mailing list -- [email protected] To unsubscribe s

[Python-ideas] Alternative to `enumerate` and `range(len(sequence))`: indexes() and entries()

2019-12-26 Thread Marco Sulla via Python-ideas
same for entries(). It should be: 1. a SequenceEntriesView 2. a generator that yields the tuples (index, value) What do you think about? ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-le...@pytho

[Python-ideas] Re: Fix statistics.median()?

2019-12-26 Thread Marco Sulla via Python-ideas
If the NaNs are not really member of your population, it's ok. On the contrary, if you use my median function with the key function I posted before, you have not this problem. The iterable is sorted well and you get the real median. _______ Pyth

[Python-ideas] Re: Fix statistics.median()?

2019-12-26 Thread Marco Sulla via Python-ideas
Oh my... Mertz, listen to me, you don't need a parameter. You only need a key function to pass to `sorted()` If you use this key function: https://mail.python.org/archives/list/[email protected]/message/M3DEOZLA63Z5OIF6H6ZCEXK36GQMLVVA/ in my median() function: https://mail.pytho

[Python-ideas] Re: Argumenting in favor of first()

2019-12-26 Thread Marco Sulla via Python-ideas
ue to use the iterable to access the rest of the iterable. `first()` creates an iterator, uses it and throw it away. What a waste! Greta Thunberg is very angry with you all :D So 200 posts for one line less? I really don't catch the point. _______ Py

[Python-ideas] Re: Fix statistics.median()?

2019-12-26 Thread Marco Sulla via Python-ideas
their code because it slow down their applications like an old man with the hat driving a camion in a street, and be happy. Sayonara. > On Thu, Dec 26, 2019, 10:42 PM Marco Sulla via Python-ideas > [email protected] wrote: > > Oh my... Mertz, listen to me, you don't need

[Python-ideas] Re: `set` API and various sorting problems

2019-12-27 Thread Marco Sulla via Python-ideas
Steven, can you please remember me what operations can return NaN? I remember for example 0/0 and +Infinity - +Infinity. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https

[Python-ideas] Re: Alternative to `enumerate` and `range(len(sequence))`: indexes() and entries()

2019-12-27 Thread Marco Sulla via Python-ideas
Steven D'Aprano wrote: > On Fri, Dec 27, 2019 at 02:22:48AM -, Marco Sulla via Python-ideas wrote: > > It's very common to see: > > for i, x in enumerate(sequence): > > [...] > > > > Yes, that is very common, except that "sequence" ca

[Python-ideas] Re: PEP 584 (dict merge operators), dict.update and dict.gapfill

2019-12-27 Thread Marco Sulla via Python-ideas
Excuse me Mr. Fine, can't you simply do `d2.update(c2)`??? ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Me

[Python-ideas] Re: Argumenting in favor of first()

2019-12-27 Thread Marco Sulla via Python-ideas
he code. KISSes. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/l

[Python-ideas] Re: findfirst() from findalliter(), and first

2019-12-27 Thread Andrew Barnert via Python-ideas
That’s also a great argument that it should be added to the re module, so people don’t have to try to figure out how to port C code to Python and then test the hell out of it just to get something that’s only missing in the first place for historical/naming reasons. _____

[Python-ideas] Re: findfirst() from findalliter(), and first

2019-12-28 Thread Andrew Barnert via Python-ideas
suite with wide coverage that you could adapt to compare list(findalliter) vs. findall or something? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at

[Python-ideas] Re: Testing for NANs [was Re: Fix statistics.median()?]

2019-12-28 Thread Andrew Barnert via Python-ideas
es, not a fully general one. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/pyth

[Python-ideas] Re: Testing for NANs [was Re: Fix statistics.median()?]

2019-12-29 Thread Andrew Barnert via Python-ideas
On Dec 28, 2019, at 23:29, Steve Barnes wrote: > >  > From: Andrew Barnert > Sent: 28 December 2019 20:21 > To: Steve Barnes > Cc: Christopher Barker ; [email protected]; python-ideas > > Subject: Re: [Python-ideas] Re: Testing for NANs [was Re: Fix > statistics

[Python-ideas] Re: Testing for NANs [was Re: Fix statistics.median()?]

2019-12-29 Thread Andrew Barnert via Python-ideas
On Dec 29, 2019, at 04:34, Steven D'Aprano wrote: > > On Sat, Dec 28, 2019 at 11:58:35PM -0800, Andrew Barnert via Python-ideas > wrote: > >> No it won’t, unless you assume here that no possible non-numeric types >> could ever have non-self-equal values. Which is

[Python-ideas] Re: The "When" Keyword

2019-12-29 Thread Andrew Barnert via Python-ideas
omes true, notify a condition variable…). I think I wrote a facetious post on my old Stupid Python Ideas blog on all the control flow statements Python is “missing” and included a when for this purpose. I don’t think the advantage is anywhere near worth the cost. Being explicit about whic

[Python-ideas] Re: The "When" Keyword

2019-12-29 Thread Andrew Barnert via Python-ideas
On Dec 29, 2019, at 12:52, Richard Damon wrote: > > On 12/29/19 3:13 PM, Andrew Barnert via Python-ideas wrote: >>> On Dec 29, 2019, at 10:57, Abdur-Rahmaan Janhangeer >>> wrote: >>> >>>> On Sun, Dec 29, 2019 at 10:45 PM Antoine Rozo >>>

[Python-ideas] Re: Fix statistics.median()?

2019-12-29 Thread Andrew Barnert via Python-ideas
t is for the sake of making sense of computer programs. (In the case of uint16, that actually does form a useful structure on its own if you consider them as Z/65536Z, but maybe it’s still worth considering them as an approximation of N instead.) _______ Py

[Python-ideas] Re: Fix statistics.median()?

2019-12-29 Thread Andrew Barnert via Python-ideas
On Dec 29, 2019, at 15:19, David Mertz wrote: > >  > On Sun, Dec 29, 2019, 5:20 PM Andrew Barnert via Python-ideas >> But it is, out of all of the possible magma-over-magma structures on those >> values, the one that most closely approximates—in a well-defined an

[Python-ideas] Re: Fix statistics.median()?

2019-12-29 Thread Andrew Barnert via Python-ideas
the first NaN that way than by doing an extra pass, if it’s simpler and slightly faster for the non-exceptional case? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.py

[Python-ideas] Re: Fix statistics.median()?

2019-12-29 Thread Andrew Barnert via Python-ideas
l kinds of places. Likewise, it’s even easier to write ignore-nan yourself than to write the DSU yourself: median = statistics.median(x for x in xs if not x.isnan()) … and yet this whole proposal is still useful, isn’t it? So, why isn’t adding a key parameter (as well as an on_nan that take

[Python-ideas] Re: Fix statistics.median()?

2019-12-29 Thread Andrew Barnert via Python-ideas
at’s a lot less obvious and a lot more useful. And the same is true for IEEE binary64. You can say they’re not numbers, or that they are, or that some of them are and some of them aren’t, but they’re not the rationals (or the reals or the affinely extended reals or a subalgebra of any of the a

[Python-ideas] Re: Fix statistics.median()?

2019-12-29 Thread Andrew Barnert via Python-ideas
already got an on_nan param, adding another value to that param doesn’t add as much cognitive load as adding a whole other param would. But I think a total order value is so rarely useful that it’s probably more load than it’s worth, while a key param is a more widely useful and therefore wor

[Python-ideas] Re: Fix statistics.median()?

2019-12-29 Thread Andrew Barnert via Python-ideas
hich one of those intuitions was wrong? Neither; they’re both right, and therefore we just found a new way to distinguish between two useful classes of “number” structures. We’re farther from ever from knowing which things are “really numbers”, but who cares? _______

[Python-ideas] Re: Fix statistics.median()?

2019-12-29 Thread Andrew Barnert via Python-ideas
pecify it explicitly.) _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/arch

[Python-ideas] Re: Fix statistics.median()?

2019-12-29 Thread Andrew Barnert via Python-ideas
ed order, even if the fact that this happens to be done by actually sorting the values is an implementation detail you shouldn’t care about. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.

[Python-ideas] Re: Total_order

2019-12-29 Thread Andrew Barnert via Python-ideas
harder to debug your code when you can’t inspect the values, but on the plus side you do feel really clever for a few seconds when you first get it working. :) _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python

[Python-ideas] Re: Fix statistics.median()?

2019-12-30 Thread Andrew Barnert via Python-ideas
On Dec 29, 2019, at 23:50, Steven D'Aprano wrote: > > On Sun, Dec 29, 2019 at 06:23:03PM -0800, Andrew Barnert via Python-ideas > wrote: > >> Likewise, it’s even easier to write ignore-nan yourself than to write the >> DSU yourself: >> >>median

[Python-ideas] Re: Fix statistics.median()?

2019-12-30 Thread Andrew Barnert via Python-ideas
st reject their use as unimportant. > As to why NaNs are greater than infinity, that comes from the IEEE > specification on the total_order relationship of floating point numbers. So what? If you care about IEEE total order, you want IEEE total order, not an unspecified idiosyncratic order th

[Python-ideas] Re: Fix statistics.median()?

2019-12-30 Thread Andrew Barnert via Python-ideas
yet. I think there are a lot more users of the statistics module who would be helped by raise and ignore options on median than by just giving them the simple tools to build that behavior themselves and hoping they figure out that they need to. _________

[Python-ideas] Re: Fix statistics.median()?

2019-12-30 Thread Andrew Barnert via Python-ideas
> On Dec 30, 2019, at 14:05, Richard Damon wrote: > > On 12/30/19 4:22 PM, Andrew Barnert via Python-ideas wrote: >>> On Dec 30, 2019, at 06:50, Richard Damon wrote: >>> On 12/30/19 12:06 AM, Andrew Barnert wrote: >>>>> On Dec 29, 2019, at 20

[Python-ideas] Re: Fix statistics.median()?

2019-12-30 Thread Andrew Barnert via Python-ideas
2 elements before sorting, and, given IGNORE (and POISON?) they probably need to instead check for that after the filter-and-sort step. (Presumably asking for the xtile of [nan, nan, nan] with IGNORE is an error, not nan.) ___ Python-ideas mailing list -- python-ideas@pyth

[Python-ideas] Re: Philosophy of floating-point (was Fix statistics.median())

2019-12-30 Thread Andrew Barnert via Python-ideas
by the exponent times the sign, which handles both -0<0 and more vs. less subnormal representations of equal finite values. While we’re at it, IIRC, it specifically mandates a<=b rather than a_______ Python-ideas mailing list -- [email protected] To u

[Python-ideas] Re: more readable "if" for multiple "in" condition

2019-12-31 Thread Andrew Barnert via Python-ideas
s of the right side’s type. And I don’t think you’d want these classes to be “magical” things that can override operators in a way that you couldn’t write yourself, so the only way to make this proposal work is to change the entire operator data model in a pretty drastic way. ___

[Python-ideas] Re: more readable "if" for multiple "in" condition

2019-12-31 Thread Andrew Barnert via Python-ideas
o translate that repeated check to a set operation. ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.pytho

[Python-ideas] Re: more readable "if" for multiple "in" condition

2019-12-31 Thread Andrew Barnert via Python-ideas
through to understand your code. At which point, even if it’s fewer characters than using a set operator where it makes sense, or a generator expression inside any otherwise, it’s still not more readable. ___ Python-ideas mailing list -- python-ideas

[Python-ideas] Re: Allow metaclass to override __subclasscheck__ for metaclass relations

2019-12-31 Thread Andrew Barnert via Python-ideas
nd if you do, the fact that the error message isn’t as meaningful as it could be isn’t a huge deal.) But you said “many places”. Is there a wider class of places, that includes the metaclass conflict check, where virtual subclassing is ignored but (you think) shouldn’t be? ______

[Python-ideas] Re: Allow metaclass to override __subclasscheck__ for metaclass relations

2019-12-31 Thread Andrew Barnert via Python-ideas
ause problems. > Namely, the C API and builtins. But, more importantly, it wouldn't work there > anyway since you can't monkeypatch __instancecheck__ / __subclasscheck__ of > built-ins in the first place. I didn’t think of that. But you don’t have to monkeypatch them to hot that

[Python-ideas] Re: more readable "if" for multiple "in" condition

2019-12-31 Thread Andrew Barnert via Python-ideas
On Dec 31, 2019, at 11:50, MRAB wrote: > > On 2019-12-31 17:49, Andrew Barnert via Python-ideas wrote: >>> On Dec 31, 2019, at 08:03, Richard Damon wrote: >>> IF I were to change the syntax ( which I don't propose), I believe the >>> construct like f

[Python-ideas] Target-and-expression lists and if-try

2019-12-31 Thread Andrew Barnert via Python-ideas
if people want to bikeshed the spelling before even seeing what it’s good for, well, this is Python-ideas. :) _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.or

[Python-ideas] Re: Target-and-expression lists and if-try

2019-12-31 Thread Andrew Barnert via Python-ideas
x27;s been reconnected! You got an SMS from {number}! Message: {message}") elif try SMS, number, message := m: notify(f"You got an SMS from {number}! Message: {message}") elif try VoiceRecording, name, link := m: notify(f"You receiv

[Python-ideas] Re: Target-and-expression lists and if-try

2019-12-31 Thread Andrew Barnert via Python-ideas
On Dec 31, 2019, at 14:58, Soni L. wrote: > > >> On 2019-12-31 7:28 p.m., Andrew Barnert via Python-ideas wrote: >> >> The second is an “if try” statement, which tries an expression and runs the >> body if that doesn’t raise (instead of if it’s truthy), but j

[Python-ideas] Re: Target-and-expression lists and if-try

2019-12-31 Thread Andrew Barnert via Python-ideas
On Dec 31, 2019, at 15:52, Greg Ewing wrote: > > On 1/01/20 11:28 am, Andrew Barnert via Python-ideas wrote: > >> The first is to extend unpacking assignment to target-or-expression lists. >> Like this: >>x, 0, z = vec >> But >> it doesn’t bind anyt

[Python-ideas] Re: Target-and-expression lists and if-try

2019-12-31 Thread Andrew Barnert via Python-ideas
On Dec 31, 2019, at 17:54, David Mertz wrote: > >  >> On Tue, Dec 31, 2019 at 8:23 PM Andrew Barnert via Python-ideas >> wrote: > >> > K = 42 >> > x, K, z = vec >> Yes. I’m surveying the way other languages deal with this to try to figure &

[Python-ideas] Re: Target-and-expression lists and if-try

2019-12-31 Thread Andrew Barnert via Python-ideas
rejected on that basis. (Which I think is a serious possibility. Something about if-try still smells weird to me in a way I haven’t figured out yet.) _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-le...

[Python-ideas] Re: Target-and-expression lists and if-try

2020-01-01 Thread Andrew Barnert via Python-ideas
oposal no longer requires a new opt-in mechanism for simulating ADTs before it can even get off the ground.) _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org

[Python-ideas] Re: Target-and-expression lists and if-try

2020-01-01 Thread Andrew Barnert via Python-ideas
>> On Jan 1, 2020, at 04:21, Steven D'Aprano wrote: >> >> On Tue, Dec 31, 2019 at 05:18:59PM -0800, Andrew Barnert via Python-ideas >> wrote: >> >> Some languages use special syntax to mark either values or targets: >> let x, K, let z = vec >

[Python-ideas] Re: Target-and-expression lists and if-try

2020-01-01 Thread Andrew Barnert via Python-ideas
On Jan 1, 2020, at 07:03, Steven D'Aprano wrote: > > On Tue, Dec 31, 2019 at 02:28:26PM -0800, Andrew Barnert via Python-ideas > wrote: > >>if try 0, y, z := vec: >># do yz plane stuff >>elif try x, 0, z := vec: >># do xz

[Python-ideas] Re: Target-and-expression lists and if-try

2020-01-01 Thread Andrew Barnert via Python-ideas
ome up with a JS-inspired proposal for Python, it might turn out very cool. But I think it would be pretty different from the tack I’m taking. > Here's the end of an older python-ideas thread: > https://mail.python.org/archives/search?mlist=python-ideas%40python.org&q=pattern+

[Python-ideas] Re: Target-and-expression lists and if-try

2020-01-01 Thread Andrew Barnert via Python-ideas
g case, or the try-expression PEP is up for reconsideration and incompatible with it, etc., that’s *not* fine; anything I build that requires “if try” will not be acceptable, so it’s not worth exploring further. _______ Python-ideas mailing list -- python-i

[Python-ideas] Re: Target-and-expression lists and if-try

2020-01-02 Thread Andrew Barnert via Python-ideas
m = Matching(vec) if try (Vec3, x, 0, z) := m: I’m not sure if that still fits with your design, but I think it could. > What do you think? I think it could be worth following up on. If you plan to do so, I could dump my incomplete notes for the other syntax on you so you can s

[Python-ideas] Re: Target-and-expression lists and if-try

2020-01-03 Thread Andrew Barnert via Python-ideas
xz_stuff(x, z) … would be roughly equivalent to: try: x, 0, z = vec except ValueError. pass else: xz_stuff(x, z) What you’ve given is a way to put code in the one place where we didn’t want any (but had to put a “pass” just for syntactic reasons) without putt

[Python-ideas] Re: concurrent.futures cancel pending at Executor.shutdown

2020-01-03 Thread Andrew Barnert via Python-ideas
the N seconds are up, you can just daemonize the whole pool, do your emergency shutdown code, and exit or abort, after which the daemon threads get safely killed immediately. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an

[Python-ideas] Re: Python, Be Bold!

2020-01-03 Thread Andrew Barnert via Python-ideas
rlier bug fix build of the same minor version?) But it’s simple enough to do that rather than guessing you can just try it. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail

[Python-ideas] Re: concurrent.futures cancel pending at Executor.shutdown

2020-01-03 Thread Andrew Barnert via Python-ideas
what multiprocessing.dummy.Pool.terminate (+ join after) does. IIRC, it only does that by accident, because dummy.Process.terminate is a no-op, and that isn’t documented but just happens to be what CPython does. ___ Python-ideas mailing list --

[Python-ideas] Re: Python, Be Bold!

2020-01-05 Thread Andrew Barnert via Python-ideas
your environment? The fact that the browser environment wasn’t originally designed for anything but JS is the only reason “Python in the browser” is a major project rather than trivial. _______ Python-ideas mailing list -- [email protected] To unsub

<    4   5   6   7   8   9   10   11   12   13   >