; 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 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
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
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
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
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
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
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
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
’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 --
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
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
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]
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
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
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
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
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
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.
___
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
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
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
.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
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
> 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
’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
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
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.
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
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
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
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/
> 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
; 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?
__
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.
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
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
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
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.
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 <
> 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
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
&
= 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
____
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
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
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
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
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
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
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
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
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
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
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
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.
_____
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
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
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
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
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
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 >>>
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
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
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
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
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
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
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?
_______
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
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.
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
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
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
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.
_________
> 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
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
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
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.
___
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
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
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?
______
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
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
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
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
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
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
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
&
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...
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
>> 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
>
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
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+
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
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
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
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
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
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 --
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
801 - 900 of 1693 matches
Mail list logo