[Python-Dev] Re: [RELEASE] The cursed fourth Python 3.11 beta (3.11.0b4) is available

2022-07-14 Thread Alan G. Isaac
4. It implements ISO 8601 (which exists for a reason): https://en.wikipedia.org/wiki/ISO_8601#Calendar_dates On 7/14/2022 6:25 PM, MRAB wrote: I much prefer -MM-DD (or .MM.DD) because: 1. It's consistent with HH:MM:SS and other instances where there are multiple  units (they go from 

[Python-Dev] Re: unittest of sequence equality

2021-01-09 Thread Alan G. Isaac
On 1/8/2021 2:50 PM, Chris Barker via Python-Dev wrote: If there are other common types this helps with, sure. But for numpy, as pointed out elsewhere in this thread, it would still fail for numpy arrays of > 1 dimension. Personally I think this is really an issue with the structure of unitest

[Python-Dev] Re: unittest of sequence equality

2020-12-22 Thread Alan G. Isaac
This comment completely misses the point. This "weird type" qualifies as a Sequence. (See collections.abc.) Alan Isaac On 12/22/2020 3:09 PM, Ivan Pozdeev via Python-Dev wrote: Or just bail out ("resist the temptation to guess") and tell the user to compare their weird types themselves.

[Python-Dev] Re: unittest of sequence equality

2020-12-22 Thread Alan G. Isaac
]==np.array([False, False]): print("foo") <...> ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() On 22.12.2020 21:52, Alan G. Isaac wrote: The following test fails because because `seq1 == seq2` returns a (boolean) NumP

[Python-Dev] unittest of sequence equality

2020-12-22 Thread Alan G. Isaac
The following test fails because because `seq1 == seq2` returns a (boolean) NumPy array whenever either seq is a NumPy array. import unittest import numpy as np unittest.TestCase().assertSequenceEqual([1.,2.,3.], np.array([1.,2.,3.])) I expected `unittest` to rely only on features

[Python-Dev] Re: A question about pattern matching

2020-11-24 Thread Alan G. Isaac
On 11/24/2020 4:40 PM, Marco Sulla wrote: I have a question about pattern matching: is it used often in math language as Mathematica? Yes, pattern matching is absolutely fundamental to Mathematica. See the `MatchQ` function: https://reference.wolfram.com/language/ref/MatchQ.html This works

[Python-Dev] Re: Words rather than sigils in Structural Pattern Matching

2020-11-17 Thread Alan G. Isaac
In Mathematica, you might do this as (roughly): rules = { {x_, y_, z_} :> {x, y, z}, {x_, y_} :> {x, y, 0.0}, x_ :> {x, 0.0, 0.0} } process[Replace[obj, rules]] Whatever you think of the particular syntax: The ability to declare resuable rules seems good. Thinking of replacement

[Python-Dev] Re: Recent PEP-8 change

2020-06-30 Thread Alan G. Isaac
Which people in the Python community are entitled to say that they find a commit message to be offensive and have that claim treated seriously, compassionately, and as a good reason for accommodative action? Under what circumstances is the appropriate response of the community a dismissive "you