[Python-ideas] Re: Arrow functions polyfill

2021-02-13 Thread Cade Brown
t, 13 Feb 2021 16:25:24 -0500 > Cade Brown wrote: > > > In my humble opinion, arrows should be '->' instead of '=>'. It always > > annoys me when languages use that symbol > > That's unlikely, as was discussed in this thread previously: > >

[Python-ideas] Re: Arrow functions polyfill

2021-02-13 Thread Cade Brown
In my humble opinion, arrows should be '->' instead of '=>'. It always annoys me when languages use that symbol On Sat, Feb 13, 2021, 14:52 Paul Sokolovsky wrote: > Hello, > > On Sat, 13 Feb 2021 09:24:51 -0800 > Matthias Bussonnier wrote: > > > Works well with 0 parameters and currying, read a

[Python-ideas] Re: str.isfloat()

2020-12-27 Thread Cade Brown
You should really just write your own function -- Python can't include every validation function you can think of. It already provides an extensible and well tested float conversion which throws an exception on bad input (the 'float' constructor) You want it to not throw an exception, but rather r

[Python-ideas] Re: A python_include() for cgi programming

2020-11-03 Thread Cade Brown
``` import myfile ``` or ``` from myfile import * ``` Will import the names from another file. You should use this instead of executing text read from a path. Thanks, *Cade Brown* Research Assistant @ ICL (Innovative Computing Laboratory) Personal Email: brown.c...@gmail.com ICL/College

[Python-ideas] Re: Method to efficiently advance iterators for sequences that support random access

2020-10-07 Thread Cade Brown
I have also thought it would be nice to have a 'prev()' method to compliment 'next()' On Wed, Oct 7, 2020, 3:24 PM Wes Turner wrote: > __setstate__, a generic __getstate__, listiter.__setstate__, (typed) > arrays and memoryviews > > ```python > import collections.abc > from array import array >

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-15 Thread Cade Brown
;>> 1 / 0 >>> 1 / 0.0 inf This would also be very unexpected *Cade Brown* Research Assistant @ ICL (Innovative Computing Laboratory) Personal Email: brown.c...@gmail.com ICL/College Email: c...@utk.edu On Tue, Sep 15, 2020 at 7:02 AM Paul Moore wrote: > On Tue,

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-14 Thread Cade Brown
To me it seems like a useful shortcut that means: >>> x == True and type(x) == bool But, as you say, it is best to just let the Python interpreter treat it as a boolean (i.e. within an `if`, it is converted automatically) Now, I am thinking it would actually be *bad* to have the CPython impleme

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-13 Thread Cade Brown
ng a float from C, check if it is infinite, and if so, return a new reference to the global inf/-inf variable). Again, this is not part of the PEP, so I don't think we want to spend much time discussing whether they should be singletons. For now, the answer seems to be: no Thanks, *

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-13 Thread Cade Brown
inf' and 'nan' to builtin names (like True and False). If that happened, a 'nan' singleton wouldn't make sense unless you had 2**53 of them, so code like: >>> x is nan Would be a flawed formulation Thanks, *Cade Brown* Research Assistant @ ICL (Innovative

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-12 Thread Cade Brown
As per tagged nans, check for JavaScript tagged NaN optimization. Essentially, the tag of the NaN (i.e. the mantissa) is interpreted as a pointer. Obviously, this is a very advanced use case, probably not worth Python guaranteeing such behavior. Here is one article: https://brionv.com/log/2018/05/1

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-12 Thread Cade Brown
If, in the future, Python used a library such as MPFR and made all floats a given precision (say, by giving a flag to the interpreter "python -prec2048"), it would never be enough to make infinity because it only has the limitation of a 64 bit exponent. This is just an example of course, probably

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-11 Thread Cade Brown
This syntax seems ugly to me, clunky, and as you said probably breaks existing code This, to me, is less clear than current methods of generating an 'inf' which is the whole reason I proposed it Thanks, ---- *Cade Brown* Research Assistant @ ICL (Innovative Computing Laboratory) Pers

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-09 Thread Cade Brown
on-1 email conversations, or should it be kept in the public mailing list? Thanks, ---- *Cade Brown* Research Assistant @ ICL (Innovative Computing Laboratory) Personal Email: brown.c...@gmail.com ICL/College Email: c...@utk.edu On Tue, Sep 8, 2020 at 11:48 PM Guido van Rossum wrote: > If

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-05 Thread Cade Brown
n one which is preventing real programs from being written On Sat, Sep 5, 2020, 11:02 PM Guido van Rossum wrote: > On Sat, Sep 5, 2020 at 5:21 PM Cade Brown wrote: > >> [...] we could spent all day going over particular cases which the repr >> -> eval identity doesn'

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-05 Thread Cade Brown
>>> inf =3 >>> eval(repr([1.0, 2.0, float('inf')])) Obviously these are edge cases, and we could spent all day going over particular cases which the repr -> eval identity doesn't hold. However I still think that, as a principle, it's a solid one. I think changing the repr of 'inf' to 'float('inf'

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-05 Thread Cade Brown
You can absolutely represent pi or e with a constant (3.14159265358979) The same cannot be said for infinity, hence why it should be a constant rather than a function call to retrieve the value On Sat, Sep 5, 2020, 4:08 PM David Mertz wrote: > On Sat, Sep 5, 2020 at 3:39 PM Cade Br

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-05 Thread Cade Brown
nstead of a keyword (that way, no pre-existing code would break, except really weird code that only works if 'inf' is *not* defined). *Cade Brown* Research Assistant @ ICL (Innovative Computing Laboratory) Personal Email: brown.c...@gmail.com ICL/College Email: c...@utk.edu On

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-04 Thread Cade Brown
similar to 'Infinity' constants (some differences: `float('nan') is float('nan')` is False, whereas `NaN is NaN` would be True, but of course `NaN == NaN` is still False) Thanks, *Cade Brown* Research Assistant @ ICL (Innovative Computing Laboratory) Personal Email:

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-04 Thread Cade Brown
mplete, predictable and frankly 'prettier' language (albeit subjective). I don't see how any of your points address those concerns On Fri, Sep 4, 2020, 10:14 PM Steven D'Aprano wrote: > On Fri, Sep 04, 2020 at 09:40:55PM -0400, Cade Brown wrote: > > The `eval(repr(x

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-04 Thread Cade Brown
#x27;d like to not focus on arguing whether a particular codebase should be using 'eval' on strings generated by repr. Rather, my point was that the current behavior does not follow what Python suggests and says 'repr' should do. *Cade Brown* Research Assistant @ ICL (Innovative

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-04 Thread Cade Brown
n > > The same value > > In [4]: math.inf == float('inf') > > Out[4]: True > > but not the same object -- i.e. it's not a singleton. > > In [5]: math.inf is float('inf') > > Out[5]: False > > -CHB > > > > On Fri, Sep 4, 2020

[Python-ideas] 'Infinity' constant in Python

2020-09-04 Thread Cade Brown
essly as it does with other floating point constants. A few rebuttals/claims against: - Creating a new constant (Infinity) which is unassignable may break existing code - Converting a float to string is not the same as it is in C. Whil I also realize that there is `math.inf`, but I argue th

[Python-ideas] Re: Reliable Ordering Of Sets

2020-08-24 Thread Cade Brown
When I quoted 10% as a rough measurement I was referring more to set operations like union, etc, which choosing the larger set may have a very real performance advantage. For membership tests which are false, it may be quicker, as less memory is accessed. The buckets will be smaller (1,2,4, or 8

[Python-ideas] Re: Reliable Ordering Of Sets

2020-08-24 Thread Cade Brown
push back on the idea that ordered-by-insertion sets are not more memory efficient -- they can use the same optimizations that ordered-by-insertion dictionaries are currently using (albeit with tighter margins, since only 2 words are saved per empty bucket instead of 3, as with dictionaries)

[Python-ideas] Reliable Ordering Of Sets

2020-08-24 Thread Cade Brown
y belief (and I'm sure many others share this as well) that unspecified/implementation-dependent/otherwise-undependable features should be eliminated and replaced with exact semantics that do not suprise users. Thoughts? Thanks, ~ Cade Brown Working on MAGMA <https://icl.cs.utk.ed