On 26.08.2021 02:36, Finn Mason wrote:
> Perhaps a warning could be raised but the NaNs are ignored. For example:
>
> Input: statistics.mean([4, 2, float('nan')])
> Output: [warning blah blah blah]
> 3
>
> Or the NaNs could be treated as zeros and a warning raised:
>
> Input: statistics.mean([4,
On 26/08/2021 09:36, Marc-Andre Lemburg wrote:
In Python you can use a simple test for this:
I think you need math.isnan().
nan = float('nan')
l = [1,2,3,nan]
d = {nan:1, 2:3, 4:5, 5:nan}
s = set(l)
nan in l
True
That only works with identical nan-s, and because the container omits
the e
Returning a NaN by default has the advantage of being consistent with IEEE 754
semantics for sequence-based operations (like `sum` and `dot`) and with
existing Python `math` module functions like `fsum`, `prod` and `hypot`. In
IEEE 754, the majority of operations silently return a NaN (not signa
On 26.08.2021 10:02, Peter Otten wrote:
> On 26/08/2021 09:36, Marc-Andre Lemburg wrote:
>
>> In Python you can use a simple test for this:
>
> I think you need math.isnan().
>
> nan = float('nan')
> l = [1,2,3,nan]
> d = {nan:1, 2:3, 4:5, 5:nan}
> s = set(l)
> nan in l
>> Tr
On Thu, Aug 26, 2021 at 11:05:01AM +0200, Marc-Andre Lemburg wrote:
> Oh, good point. I was under the impression that NAN is handled
> as a singleton.
There are 4503599627370496 distinct quiet NANs (plus about the same
signalling NANs). So it would need to be 4-quadrillion-ton :-)
(If anyone is
On Wed, Aug 25, 2021 at 10:40:59PM -0700, Christopher Barker wrote:
> On Wed, Aug 25, 2021 at 5:39 PM Finn Mason wrote:
>
> > Or the NaNs could be treated as zeros and a warning raised:
> >
>
> Absolutely not! NaN in no way means zero, ever. We should never provide a
> known incorrect result.
I
On 26.08.2021 12:15, Steven D'Aprano wrote:
> On Thu, Aug 26, 2021 at 11:05:01AM +0200, Marc-Andre Lemburg wrote:
>
>> Oh, good point. I was under the impression that NAN is handled
>> as a singleton.
>
> There are 4503599627370496 distinct quiet NANs (plus about the same
> signalling NANs). So
Currently, when what to execute external command, either os.system() or
subprocess functions should be invoked.
However, it is not so convenient, it would be nice to use "``" symbol to brace
the shell command inside.
like:
stdout_result_str = `cat file.txt | sort | grep hello`
Its is enhanced
subprocess.run(args, capture_output=True, check=True, text=True,
encoding="utf8").stdout ?
On Thu, 26 Aug 2021, 13:55 Evan Greenup via Python-ideas, <
[email protected]> wrote:
> Currently, when what to execute external command, either os.system() or
> subprocess functions should be invoked
Tim, you're right. I'm sorry. When this was first posted, I was sure it
would be resolved quickly and easily. I very badly communicated that.
On Thu, Aug 26, 2021, 12:59 AM Tim Hoffmann
wrote:
> Hi Finn,
>
> as a personal feedback: I perceive this comment as disrespectful and not
> welcoming. I'
There is a Python library called plumbum that provides a shell-like DSL for
executing shell commands:
https://plumbum.readthedocs.io/en/latest/
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python-ideas-le...@py
> There is a Python library called plumbum that provides a shell-like DSL
> for executing shell commands:
Also xonch:
https://xon.sh
Python itself is purposely not designed to provide quick and easy shell
access.
-CHB
--
Christopher Barker, PhD (Chris)
Python Language Consulting
- Teachi
There have been a number of discussions on this list, and at least one PEP,
about NaN (and other special values).
Let’s keep this thread about handling them in the statistics lib.
But briefly:
NaNs are weird on purpose, and Python should absolutely not deviate from
IEEE.
That’s (one reason) Pyt
On 2021-08-23 20:53, Steven D'Aprano wrote:
So I propose that statistics functions gain a keyword only parameter to
specify the desired behaviour when a NAN is found:
- raise an exception
- return NAN
- ignore it (filter out NANs)
which seem to be the three most common preference. (It seems t
On 26.08.2021 17:36, Christopher Barker wrote:
> There have been a number of discussions on this list, and at least one PEP,
> about NaN (and other special values).
>
> Let’s keep this thread about handling them in the statistics lib.
>
> But briefly:
>
> NaNs are weird on purpose, and Python s
On Thu, Aug 26, 2021, at 08:50, Evan Greenup via Python-ideas wrote:
> Currently, when what to execute external command, either os.system() or
> subprocess functions should be invoked.
>
> However, it is not so convenient, it would be nice to use "``" symbol
> to brace the shell command inside.
And also IPython:
https://ipython.readthedocs.io/en/stable/interactive/shell.html
e.g.
ls_lines = !ls -l
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mail
On Thu, Aug 26, 2021, 6:46 AM Marc-Andre Lemburg
> Fair enough. Would it then make sense to at least have all possible NAN
> objects compare equal, treating the extra error information as an attribute
> value rather than a distinct value and perhaps exposing this as such ?
>
No, no, no!
Almost t
On Thu, Aug 26, 2021 at 5:53 AM Evan Greenup via Python-ideas <
[email protected]> wrote:
> Currently, when what to execute external command, either os.system() or
> subprocess functions should be invoked.
>
> However, it is not so convenient, it would be nice to use "``" symbol to
> brace t
> Is this too magical?
> result = run('cat file.txt') | run('sort) | run('grep hello',
capture_output=True, text=True).stdout
Interesting idea, especially overloading the union/pipe operator (|). I
like it a lot. It reminds me of pathlib.Path (which is a wonderful tool),
with its slash operator ov
On Fri, Aug 27, 2021 at 1:15 PM Finn Mason wrote:
>
> > Is this too magical?
> > result = run('cat file.txt') | run('sort) | run('grep hello',
> > capture_output=True, text=True).stdout
>
> Interesting idea, especially overloading the union/pipe operator (|). I like
> it a lot. It reminds me of
On Thu, Aug 26, 2021 at 12:44:18PM +0200, Marc-Andre Lemburg wrote:
> Fair enough. Would it then make sense to at least have all possible
> NAN objects compare equal, treating the extra error information as an
> attribute value rather than a distinct value and perhaps exposing this
> as such ?
>
22 matches
Mail list logo