Re: [Python-ideas] Allow additional separator character in variables

2017-11-19 Thread Richard Damon
Extended ASCII, but again, this is NOT ASCII. -- Richard Damon ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] String and bytes bitwise operations

2018-05-18 Thread Richard Damon
ing it, as often you special case some characters (like control characters) to avoid messing things up too much for display. -- Richard Damon ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code o

Re: [Python-ideas] Verbatim names (allowing keywords as names)

2018-05-18 Thread Richard Damon
so keywords could flag errors (but late enough that you don't normalize inside strings and such), or you need to normalize late (as is done) but then add a check to see if the text became the same as a keyword. Seems a shame to go to extra work to flag as an error something th

Re: [Python-ideas] Trigonometry in degrees

2018-06-08 Thread Richard Damon
lass > PiMultiple that would represent a fractional multiple of pi? > > PI = PiMultiple(1) > assert PI / 2 == PiMultiple(1, 2) > assert cos(PI / 2) == 0 > DEG = 2 * PI / 360 > assert sin(45 * DEG) == sqrt(2) / 2 > > Best regards, > Adam Bartoš > In one sense that is why I

Re: [Python-ideas] Fwd: Trigonometry in degrees

2018-06-13 Thread Richard Damon
.python.org/mailman/listinfo/python-ideas > <https://mail.python.org/mailman/listinfo/python-ideas> > Code of Conduct: http://python.org/psf/codeofconduct/ > <http://python.org/psf/codeofconduct/> > > > > > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ -- Richard Damon ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Fwd: Trigonometry in degrees

2018-06-15 Thread Richard Damon
On 6/13/18 7:21 AM, Stephan Houben wrote: > > > Op wo 13 jun. 2018 13:12 schreef Richard Damon > mailto:rich...@damon-family.org>>: > > My first comment is that special casing values like this can lead to > some very undesirable properties when you use the f

Re: [Python-ideas] Operator for inserting an element into a list

2018-06-15 Thread Richard Damon
eads as foo = foo + bar, so the first impression is that it isn't going to mutate, but rebind, but it is possible that it does an inplace rebind so to me THAT is the case where I need to dig into the rules to see what it really does. This means that at quick glance given: list1 = list list1 +

Re: [Python-ideas] Approximately equal operator

2018-06-15 Thread Richard Damon
equals' is that the definition of it is hard to come up with. This is especially true for small values. In particular how small does a number need to be to be ~= 0. You also get inconsistencies,  you can have a ~= b, and b ~= c but not a ~= c. You can have a + b ~= c but not a ~= c - b should 0.0

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Richard Damon
ay as nice precise angles) and then either adjust the final computation formulas for degrees, or convert the angle to radians and let the fundamental routine do the small angle computation. While we are at it, it might be worth thinking if it might make sense to also define a set of functions using cir

Re: [Python-ideas] "Exposing" `__min__` and `__max__`

2018-06-26 Thread Richard Damon
ed. > Monotonic (in this sense) just means never changing directions, it can be increasing and never decreasing or decreasing and never increasing so we don't need the 'anti-' version. -- Richard Damon ___ Python-ideas mailing list Python-idea

Re: [Python-ideas] Is there a reason some of the PyLong_As* functions don't call an object's __int__?

2017-12-29 Thread Richard Damon
' for that implementation. -- Richard Damon ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Make import an expression

2018-07-14 Thread Richard Damon
> On Jul 14, 2018, at 4:24 AM, Ken Hilton wrote: > > Hi all, > > Just a curious idea I had. The subject says it all. "import" is currently a > statement, which means it cannot be used inside anything else. Currently, the > only way to import a module inside an expression is to use the

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-24 Thread Richard Damon
> On Jul 24, 2018, at 7:37 AM, Rhodri James wrote: > >> On 24/07/18 12:02, David Mertz wrote: >> Every use I've suggested for the magic proxy is similar to: >> NullCoalesce(cfg).user.profile.food >> Yes, the class is magic. That much more so in the library I published last >> night that

Re: [Python-ideas] Fwd: Add Unicode-aware str.reverse() function?

2018-09-08 Thread Richard Damon
basic support (mostly just for codepoints). It could make sense to have a Unicode package that knows a lot more of the complexity of Unicode, doing things like extraction a code point package that represents a full glyph knowing all the combining rules, and

Re: [Python-ideas] Dart like multi line strings identation

2018-04-01 Thread Richard Damon
lly all of the actual implementation of these prefixes can be handled by setting a flag for the presence of that prefix, and at the parsing of each character you need to just check a flag or two to figure out how to process it. You might get a bit more complication in determining if a given combination is valid, but if that gets too complicated it is likely an indication of an inconstancy in the language definition. -- Richard Damon ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Dart like multi line strings identation

2018-04-01 Thread Richard Damon
On 4/1/18 4:31 PM, Brendan Barnwell wrote: > On 2018-04-01 05:36, Steven D'Aprano wrote: >> On Sun, Apr 01, 2018 at 08:08:41AM -0400, Richard Damon wrote: >> >>> One comment about the 'combitorial explosion' is that it sort of >>> assumes >>> t

Re: [Python-ideas] Dart like multi line strings identation

2018-04-01 Thread Richard Damon
On 4/1/18 8:36 AM, Steven D'Aprano wrote: > On Sun, Apr 01, 2018 at 08:08:41AM -0400, Richard Damon wrote: > >> One comment about the 'combitorial explosion' is that it sort of assumes >> that each individual combination case needs to be handled with distinct >>

Re: [Python-ideas] Support parsing stream with `re`

2018-10-08 Thread Richard Damon
isk is trivial to make available for another usage. Memory just sitting idle is the real waste. -- Richard Damon ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Python octal escape character encoding "wats"

2018-11-10 Thread Richard Damon
case where you might get the problem is if you had a control character (like escape) followed by a digit between 0 and 7, you needed to expand the escape to 3 digits. This was just one of the traps you learned to live with (and it seemed that terminal escape codes seemed to avoid that issue by norm

Re: [Python-ideas] Suggestion: Extend integers to include iNaN

2018-09-29 Thread Richard Damon
tter solution would be the creation of a NAN type (similar  to NONE) that implement this sort of property. That way the feature can be added to integers, rationals, and any other numeric types that exist (why do just integers need this addition). -- Richard Damon _

Re: [Python-ideas] Moving to another forum system where moderation is possible

2018-09-20 Thread Richard Damon
in the headers of the email. Filtering on Subject does a pretty good job of  'Thread' filtering You could also filter on In-Reply-To and References to get actual filtering on threads, but would need to list a lot of message-ids (especially for In-Reply-To) to block all replys to a long thread. --

Re: [Python-ideas] Moving to another forum system where

2018-09-21 Thread Richard Damon
ny of the people in charge think it is a bad message, they can reject it (first to act wins). Probably need someone to periodically review the messages that have sit for a bit and make a decision on them. Some trusted people can have their moderation status removed, and what they post goes to the l

Re: [Python-ideas] Possible PEP regarding the use of the continue keyword in try/except blocks

2019-01-05 Thread Richard Damon
ot;string") except ValueError as e:     print(e) print("continued on") j = int(9.0) i.e. the try block is the program segment that either executes successful, or your exception routine recovers from the error and sets things up to continue from there. -- Richard Damon ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Possible PEP regarding the use of the continue keyword in try/except blocks

2019-01-06 Thread Richard Damon
lled, do you return to the next line of that function, or the next line after the function call? What happens if the exception happens inside a loop (that is inside the try)? Do you just go to the next instruction in the loop and continue looping? -- Richard Damon

Re: [Python-ideas] Possible PEP regarding the use of the continue keyword in try/except blocks

2019-01-07 Thread Richard Damon
On 1/7/19 3:38 PM, Barry wrote: > >> On 7 Jan 2019, at 03:06, Richard Damon wrote: >> >> For something like reading options from a config file, I would use a >> call that specifies the key and a value to use if the key isn't present, >> and inside that functio

Re: [Python-ideas] Moving to another forum system where moderation is possible

2018-09-18 Thread Richard Damon
read gets out of bounds I can enter a message filter to hold for review any message matching the subject of that thread (or specified parts of it). While people can get around the filter by changing the subject line, they can do the same on a forum by starting a new topic. Someone who intentional

Re: [Python-ideas] Why operators are useful

2019-03-16 Thread Richard Damon
of the rigors of the language of mathematics.  Python on the other hand, while it allows providing a 'Type Hint' for the type of a variable, doesn't demand such a thing, so when looking at a piece of code you don't necessarily know the types of the objects being used (which can also be a

Re: [Python-ideas] Why operators are useful

2019-03-16 Thread Richard Damon
On 3/16/19 8:14 AM, Dan Sommers wrote: > On 3/16/19 6:17 AM, Richard Damon wrote: >> On 3/16/19 4:39 AM, Greg Ewing wrote: >>> Rémi Lapeyre wrote: >>>> I think this omit a very important property of >>>> mathematic equations thought, maths is a v

Re: [Python-ideas] True and False are singletons

2019-03-18 Thread Richard Damon
... > That means something VERY different. The first asks if the item is specifically the True value, while the second just asks if the value is Truthy, it wold be satisfied also for values like 1. -- Richard Damon ___ Python-ideas mai

Re: [Python-ideas] True and False are singletons

2019-03-18 Thread Richard Damon
ticular objects, and not create a new object with the same value, so they are Singletons, even if the type itself isn't Yes, in many languages the term Singleton is used for Types and not values, and in part that difference is due to that fact that in Pyt

Re: [Python-ideas] Operator as first class citizens -- like in scala -- or yet another new operator?

2019-05-30 Thread Richard Damon
resents the hardware system), and then after defining that, using some method to 'run' that hardware. Thus having the above be written as hardware.x = hardware.y hardware.y = hardware.x and then later: hardware,run() where the attribute assignment recorded the interconnections and the run did them

Re: [Python-ideas] [SPAM?] (meta) Mailman cleartext passwords

2019-05-14 Thread Richard Damon
ribed. (I would suggest that most lists want the subscribed list to be accessible only by a few trusted individuals to avoid scraping for spamming.) -- Richard Damon ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] [SPAM?] Re: shutil.symlink to allow non-race replacement of existing link targets

2019-05-14 Thread Richard Damon
to an assembler programmer, most Function names are symbolic labels. Yes, you CAN write a call to an absolute (or relative) memory address, but that is unusual unless you are writing an in memory patch to an already established program. Do you really write something like:   call  0x32453 very ofte

[Python-ideas] Re: Fwd: Optional kwarg for sequence methods in random module

2019-08-18 Thread Richard Damon
> On Aug 18, 2019, at 9:20 AM, Senhaji Rhazi hamza > wrote: > > Hey Steven, > > I think there is a way to map x <- [1; + inf] to y <- [0;1] by putting y = 1/x > One big issue with using that mapping is it doesn’t preserve many of the characteristics of the initial distribution. If the x

[Python-ideas] Re: Custom string prefixes

2019-08-29 Thread Richard Damon
need to be treated very differently, or perhaps somehow the prefix needs to indicate what standard prefix to use to parse the string. Some of your examples could benefit by sometimes being able to use r' and sometimes not, so being able to say both r'string're or 'string're could be useful. -- Richard

[Python-ideas] Re: Custom string prefixes

2019-08-29 Thread Richard Damon
the string > itself. > > Another option would be to have a single variant of f-string that, > instead of creating a string, creates a "string with formatted > values". That would then be a single object that can be passed around > as normal, and if conn.execute() received

[Python-ideas] Re: [SPAM?] Re: PEP's shouldn't require a sponsor

2019-07-29 Thread Richard Damon
ple using it in ways you just haven't thought about, and because you likely can't talk to everyone who will be affected (they aren't all listening to the same channel) it become important to work out more of the details so people not as familiar with what you are proposing can pe

[Python-ideas] Re: Link: Bidirectional Aliasing in Python

2019-09-24 Thread Richard Damon
ribute' to that identifier requires major changes in how that works and also will interfere with a namespace being able to override how that binding works. -- Richard Damon ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to

[Python-ideas] Re: Python should take a lesson from APL: Walrus operator not needed

2019-11-10 Thread Richard Damon
Martin, I think one thing you need to realize that just being a better idea doesn't make it easy to get implemented. There is a LOT of inertia in infrastructure, and overcoming it can be nearly impossible. A great example of that is look at your typical keyboard, if you were to create a new

[Python-ideas] Re: Python should take a lesson from APL: Walrus operator not needed

2019-11-11 Thread Richard Damon
On 11/11/19 10:10 AM, Random832 wrote: > On Mon, Nov 11, 2019, at 03:22, Greg Ewing wrote: >> On 11/11/19, 12:41 PM, Richard Damon wrote: >>> it was DESIGNED to be inefficient (that was one of its design goals, to >>> slow typesetters down to be slower than th

[Python-ideas] Re: Archiving Threads / Closing Threads

2019-12-03 Thread Richard Damon
Mailman, the manager for the mailing list doesn’t offer any such option. The closest that could be done is if a topic just goes on too long, a filter could be added to the list configuration which holds for moderation messages which match the subject. The problem is that if someone changes the

[Python-ideas] Re: Segmentation of string

2019-12-14 Thread Richard Damon
t that hard to write and could easily be part of a module to handle that sort of thing. I also suspect different application domains may have differing 'rules' of what they want, for example, why do you assume no empty strings? Also, why just strings, maybe you want to d

[Python-ideas] Re: Percent notation for array and string literals, similar to Perl, Ruby

2019-10-24 Thread Richard Damon
e machine > and an unlimited life span, I’m pretty sure I wouldn’t want to participate in > those arguments. My understanding was that the ZWNBS was provide a way to logically separate two code-points that would otherwise like to bind together for meaning. -- Richard Damon ___

[Python-ideas] Re: Percent notation for array and string literals, similar to Perl, Ruby

2019-10-24 Thread Richard Damon
My one comment about this is to quote from PEP 20, the Zen of Python There should be one-- and preferably only one --obvious way to do it. Yes, this does get broken at times with additions to the language, But this whole proposal to me seems to be an effort to introduce an alternate way to do

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-19 Thread Richard Damon
simple recovery (the built in provided by the context manager). It may be at the cost of making more complex (and explicit) handling of conditions for current (or possible future) 'eager' managers. For example, if open doesn't actually open the file, but only prepares to open, then the use of a file o

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-20 Thread Richard Damon
> On Nov 20, 2019, at 7:50 AM, Rhodri James wrote: > > On 20/11/2019 01:57, Oscar Benjamin wrote: >>> On Tue, 19 Nov 2019 at 12:03, Paul Moore wrote: >>> On Tue, 19 Nov 2019 at 11:34, Oscar Benjamin wrote: >>> If I was to propose anything here it would not be to disallow

[Python-ideas] Re: Renaming json.load()

2019-11-30 Thread Richard Damon
:-D :-D ...  |-[ > > > > I nominate this statement for the position of PICT-001 :-) > > > > Paul > -- Richard Damon ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org h

[Python-ideas] Re: math.copysign not to introduce float

2019-11-29 Thread Richard Damon
erience, copysign is really only needed for floating point numbers, and where it is used, efficiency is often at least somewhat important so adding code to make it work to produce an int result would slow things down. For a range step, I find using a ternary operation to be clearer than using c

[Python-ideas] Re: Renaming json.load()

2019-11-29 Thread Richard Damon
). Which means that even if we deprecate loads, the standard library should continue to use it and not the new load_string for awhile until it is felt safe that few people are monkey patching in a load_string member, and we can break the code. -- Richard Damon

[Python-ideas] Re: Magnitude and ProtoMagnitude ABCs — primarily for argument validation

2020-03-05 Thread Richard Damon
On 3/5/20 1:27 AM, Greg Ewing wrote: On 5/03/20 4:08 pm, Richard Damon wrote: Sometimes I wonder if since Python supports dynamic typing of results, might not do better by removing the NaN value from Floats and Decimals, and make the operations that generate the NaN generate an object

[Python-ideas] Re: Magnitude and ProtoMagnitude ABCs — primarily for argument validation

2020-03-04 Thread Richard Damon
> On Mar 4, 2020, at 10:09 AM, David Mertz wrote: > >  > This thread feels very much like a solution looking for a problem. > > But on one narrow point, I'm trying to think of everything in the standard > library or builtins that actually forms a total order with elements of the > same

[Python-ideas] Re: Magnitude and ProtoMagnitude ABCs — primarily for argument validation

2020-03-04 Thread Richard Damon
that generate the NaN generate an object of a special NaN type. -- Richard Damon ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python

[Python-ideas] Re: Magnitude and ProtoMagnitude ABCs — primarily for argument validation

2020-03-05 Thread Richard Damon
On 3/4/20 11:07 PM, Andrew Barnert via Python-ideas wrote: On Mar 4, 2020, at 19:12, Richard Damon wrote: Yes, because of the NaN issue, you sort of need an 'Almost Total Order' and 'Really Truly a Total Order', the first allowing the small exception of a very limited (maybe only one

[Python-ideas] Re: Magnitude and ProtoMagnitude ABCs — primarily for argument validation

2020-03-05 Thread Richard Damon
On 3/5/20 9:10 AM, Steven D'Aprano wrote: On Thu, Mar 05, 2020 at 08:23:22AM -0500, Richard Damon wrote: Yes, that is the idea of AlmostTotalOrder, to have algorithms that really require a total order (like sorting) Sorting doesn't require a total order. Sorting only requires a weak order

[Python-ideas] Re: Magnitude and ProtoMagnitude ABCs — primarily for argument validation

2020-03-05 Thread Richard Damon
On 3/5/20 1:37 PM, Andrew Barnert via Python-ideas wrote: On Mar 5, 2020, at 05:24, Richard Damon wrote: On 3/4/20 11:07 PM, Andrew Barnert via Python-ideas wrote: On Mar 4, 2020, at 19:12, Richard Damon wrote: Yes, because of the NaN issue, you sort of need an 'Almost Total Order

[Python-ideas] Re: Make ~ (tilde) a binary operator, e.g. __sim__(self, other)

2020-02-24 Thread Richard Damon
don't want to hurt that set to add something new. Also, all languages (well, maybe almost all) are Turing complete, so anything that you can do in one, it possible in the other, it just might not look pretty or be simple. -- Richard Damon ___ Python

[Python-ideas] Re: addition of "nameof" operator

2020-01-31 Thread Richard Damon
On Jan 31, 2020, at 11:01 AM, Soni L. wrote: > > Consider: > > x=nameof(foo.bar) > > in today's python becomes: > > foo.bar > x="bar" > > and when running this you get an AttributeError or something. > > the benefit is that "bar" is only typed once, and the attribute access (and > thus

[Python-ideas] Re: addition of "nameof" operator

2020-02-03 Thread Richard Damon
roblem is statically typed languages, as there we can determine the type of foo, and see if the change applies (at least in most cases). -- Richard Damon ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-id

[Python-ideas] Re: addition of "nameof" operator

2020-01-31 Thread Richard Damon
refactor your code you have a chance that the tool will be able to see the variable expression foo.bar, and process that like other references to the item, and thus be able to change it. Just using the string "bar" would be very hard to see the connection between

[Python-ideas] Re: Perhaps allow leading zeroes in integer literals

2020-02-07 Thread Richard Damon
e as simple leading zero to indicate octal, it may make sense to just keep the ambiguous numbers invalid forever. If we admit that the reasoning is ambiguity, then allowing the single digit numbers could make sense even if it does mean that writing the rule as a grammar

[Python-ideas] Re: addition of "nameof" operator

2020-02-01 Thread Richard Damon
too. -- Richard Damon ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org

[Python-ideas] Re: Add Binary module.

2020-02-17 Thread Richard Damon
signed BinaryInts use their MSB as the sign bit, and the others as value bits, not to have a separate sign outside the bits. -- Richard Damon ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-

[Python-ideas] Re: Incremental step on road to improving situation around iterable strings

2020-02-23 Thread Richard Damon
of existing libraries and open source projects break due to this. -- Richard Damon ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-idea

[Python-ideas] Re: Incremental step on road to improving situation around iterable strings

2020-02-23 Thread Richard Damon
from a single type of sequence, (like always a list) and anything that isn't a list is a terminal (or maybe some other type of structure that would be iterated differently) so you wouldn't actually be checking for strings, but for lists (and iterating further on them). -- Richard Damon

[Python-ideas] Re: addition of "nameof" operator

2020-01-22 Thread Richard Damon
;x", x) or some similar purpose function, and in that context, such prints should not normally be long lived or are part of long term logging in which case the stability of the label might actually be preferred to not break parsers for the log output

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

2019-12-31 Thread Richard Damon
On 12/31/19 12:49 PM, 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 foo or bar or baz in foobar to give you issues parsing. An alternative which is, in my opinion

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

2019-12-31 Thread Richard Damon
constructor and implementing its own version of things like in. (not sure if we can override 'is') -- Richard Damon ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.py

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

2019-12-30 Thread Richard Damon
consistent leading digit, so it isn't omitted, and you could have subnormal values if the leading digit is 0. The clause on handling different representations really just apply to those non-binary formats. -- Richard Damon ___ Python-ideas mailing l

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

2019-12-25 Thread Richard Damon
is set to include DMARC mitigation to domains with a DMARC of quarantine. The fact that his domain has a DMARC policy of quarantine says it really shouldn't be used on a mailing list, but that aspect is commonly ignored by the service providers. -- Richard Damon

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

2019-12-26 Thread Richard Damon
n Thu, Dec 26, 2019, 12:27 PM Richard Damon Note that the statistics module documentation implies the issue, as median implies that it requires the sequence to be orderable, and nan isn't orderable. Since the statistics module seems to be designed to handle types other than floats,

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

2019-12-26 Thread Richard Damon
sequence to be orderable, and nan isn't orderable. Since the statistics module seems to be designed to handle types other than floats, detecting nan values is extra expensive, so I think it can be excused for not checking. -- Richard Damon ___ Py

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

2019-12-26 Thread Richard Damon
han sorted, as sorted doesn't check if items are strictly comparable, but just assumes that < provides a total order, which NaN values breaks. sorted basically can generate an unsorted result if there are items like NaN that break the assumption. --

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

2019-12-26 Thread Richard Damon
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 about by explicitly requesting them (like float("nan") ) or perhaps with some of the mor

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

2019-12-26 Thread Richard Damon
powerful packages, like Numpy, so expecting it to handle this level of nuance is beyond its specification. -- Richard Damon ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https

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

2019-12-29 Thread Richard Damon
, and everyone who reads Python code now has to keep 6 control flow statements in their head instead of 5. AH, like the old conditional COME FROM statement that was proposed for FORTRAN decades ago. The anti-pattern suggested to get away from structured code

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

2019-12-29 Thread Richard Damon
On 12/29/19 12:20 AM, Brendan Barnwell wrote: On 2019-12-28 21:11, Richard Damon wrote: You seem to understand Pure Math, but not the Applied Mathematics of computers. The Applied Mathematics of Computing is based on the concept of finite approximation, which is something that Pure Math, like

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

2019-12-29 Thread Richard Damon
advanced data structures has less need for this type of thing, but I suspect that even in Python there are cases where prefilling with non-existent value could make sense as an optimization, with an advantage to having all the elements be the same type (so you wouldn't use None at the value). -

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

2019-12-29 Thread Richard Damon
On 12/29/19 1:16 AM, Christopher Barker wrote: OMG! Thus is fun and all, but: On Sat, Dec 28, 2019 at 9:11 PM Richard Damon mailto:rich...@damon-family.org>> wrote: ... practicality beats purity. And practically, everyone in this thread understands what a float is, and what

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

2019-12-29 Thread Richard Damon
On 12/29/19 7:05 PM, Christopher Barker wrote: On Sun, Dec 29, 2019 at 3:26 PM Richard Damon mailto:rich...@damon-family.org>> wrote: > Frankly, I’m also confused as to why folks seem to think this is an > issue to be addressed in the sort() functions T

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

2019-12-29 Thread Richard Damon
sorting -0 before +0 shouldn't be a problem. -- Richard Damon ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Messag

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

2019-12-29 Thread Richard Damon
On 12/29/19 8:13 PM, David Mertz wrote: On Sun, Dec 29, 2019 at 8:00 PM Richard Damon mailto:rich...@damon-family.org>> wrote: Which is EXACTLY the reason I say that if this is important enough to fix in median, it is important enough to fix in sorted. sorted gives exactly th

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

2019-12-29 Thread Richard Damon
On 12/29/19 5:41 PM, Chris Angelico wrote: On Mon, Dec 30, 2019 at 9:01 AM Richard Damon wrote: On 12/29/19 4:30 PM, Chris Angelico wrote: On Mon, Dec 30, 2019 at 5:48 AM Steven D'Aprano wrote: On Sat, Dec 28, 2019 at 09:20:49PM -0800, Brendan Barnwell wrote: Especially since it fails

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

2019-12-29 Thread Richard Damon
the number system to some Nan Number System that includes the NaNs, but in doing that we lose even more properties. The one issue is that this new invented number system, being an invented rare bird, can't be assumed when most people say 'Number'. The proper

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

2019-12-29 Thread Richard Damon
eeds to generate SOME answer. The alternative to having NaN values in the representation would be for the operations that currently generate it to fault out and either kill the program or at least generate an exception. -- Richard Damon ___ Python-ide

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

2019-12-29 Thread Richard Damon
On 12/29/19 11:00 PM, Tim Peters wrote: [Richard Damon ] IEEE total_order puts NaN as bigger than infinity, and -NaN as less than -inf. One simple way to implement it is to convert the representaton to a 64 bit signed integer (not its value, but its representation) and if the sign bit is set

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

2019-12-29 Thread Richard Damon
know how hard it is to get the representation of a float as a 64 bit integer. In C or Assembly it is fairly easy as you can easily get around the type system, but I don't know python well enough to do it. -- Richard Damon ___ Python-ideas mailing

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

2019-12-29 Thread Richard Damon
On 12/29/19 10:39 PM, David Mertz wrote: On Sun, Dec 29, 2019 at 10:18 PM Richard Damon mailto:rich...@damon-family.org>> wrote: IEEE total_order puts NaN as bigger than infinity, and -NaN as less than -inf. You mean like this? >>> def total_order(x): ...    

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

2019-12-28 Thread Richard Damon
descriptive. Also GNU isn't Unix, as Unix is a trademarked name for a specific set of operating systems. GNU produced Linux, which is a mostly work-alike operating system. Its sort of like saying Scotties isn't a Kleenex (Both brands of facial tissues). -- Richard Damon

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

2019-12-28 Thread Richard Damon
the Number line starting with Set Theory doesn't handle approximation well. In Pure Math, something that is just mostly true, and can be proved to not always be true, is considered False, but to applied math, it can be good enough. -- Richard Damon

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

2019-12-28 Thread Richard Damon
On 12/28/19 10:05 PM, David Mertz wrote: On Sat, Dec 28, 2019, 9:36 PM Richard Damon <mailto:rich...@damon-family.org>> wrote: > NaN may be an instance of the abstract type Number, but is isn't a mathematical number. Yes, floating point numbers are not pure-math Rea

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

2019-12-28 Thread Richard Damon
On 12/28/19 10:41 PM, David Mertz wrote: On Sat, Dec 28, 2019 at 10:31 PM Richard Damon mailto:rich...@damon-family.org>> wrote: Every value of the type float, except NaN and perhaps +inf and -inf (depending on which version of the Real Number Line you use) IS ac

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

2019-12-27 Thread Richard Damon
On 12/26/19 5:23 PM, Andrew Barnert via Python-ideas wrote: 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

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

2019-12-30 Thread Richard Damon
On 12/30/19 12:06 AM, Andrew Barnert wrote: On Dec 29, 2019, at 20:04, Richard Damon wrote: Thus your total_order, while not REALLY a total order, is likely good enough for most purposes. Well, it is a total order of equivalence classes (with all IEEE-equal values being equivalent, all

[Python-ideas] Re: Total_order

2019-12-30 Thread Richard Damon
k software would love ;-) -- Richard Damon ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail

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

2019-12-30 Thread Richard Damon
rade package that is built with that interpretation built in. It also likely gives better control over how the values are computed. -- Richard Damon ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-idea

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

2019-12-30 Thread Richard Damon
comparison function fails, and I am not sure if there is a easy solution to make ALL the Number classes always comparable to each other, one issue being that what type to do the comparison in most efficiently is value dependent (magnitude and how close

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

2019-12-30 Thread Richard Damon
nverts Garbage In, Crazy Garbage Out to Garbage In, Somewhat Garbage Out (maybe its abstract art?). -- Richard Damon ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.pyth

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

2019-12-30 Thread Richard Damon
On 12/30/19 12:45 PM, David Mertz wrote: On Mon, Dec 30, 2019 at 12:37 PM Richard Damon mailto:rich...@damon-family.org>> wrote: My preference is that the interpretation that NaN means Missing Data isn't appropriate for for the statistics module. You need to tel the entire

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

2019-12-30 Thread Richard Damon
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:04, Richard Damon wrote: Thus your total_order, while not REALLY a total order, is likely good enough for most

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

2019-12-27 Thread Richard Damon
to take care, so the remaining issues catch you harder. -- Richard Damon ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org

  1   2   >