Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-19 Thread Chris Angelico
On Sat, Nov 20, 2021 at 3:41 PM Ben Bacarisse wrote: > > Chris Angelico writes: > > > On Sat, Nov 20, 2021 at 12:43 PM Ben Bacarisse wrote: > >> > >> Chris Angelico writes: > >> > >> > On Sat, Nov 20, 2021 at 9:07 AM Ben Bacarisse > >> > wrote: > >> >> > >> >> Chris Angelico writes: > >> >>

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-19 Thread Ben Bacarisse
Chris Angelico writes: > On Sat, Nov 20, 2021 at 12:43 PM Ben Bacarisse wrote: >> >> Chris Angelico writes: >> >> > On Sat, Nov 20, 2021 at 9:07 AM Ben Bacarisse wrote: >> >> >> >> Chris Angelico writes: >> >> >> >> > On Sat, Nov 20, 2021 at 5:08 AM ast wrote: >> >> >> >> >> >>> 0.3 + 0.3 +

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-19 Thread Chris Angelico
On Sat, Nov 20, 2021 at 12:43 PM Ben Bacarisse wrote: > > Chris Angelico writes: > > > On Sat, Nov 20, 2021 at 9:07 AM Ben Bacarisse wrote: > >> > >> Chris Angelico writes: > >> > >> > On Sat, Nov 20, 2021 at 5:08 AM ast wrote: > >> > >> >> >>> 0.3 + 0.3 + 0.3 == 0.9 > >> >> False > >> > > >>

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-19 Thread Ben Bacarisse
Chris Angelico writes: > On Sat, Nov 20, 2021 at 9:07 AM Ben Bacarisse wrote: >> >> Chris Angelico writes: >> >> > On Sat, Nov 20, 2021 at 5:08 AM ast wrote: >> >> >> >>> 0.3 + 0.3 + 0.3 == 0.9 >> >> False >> > >> > That's because 0.3 is not 3/10. It's not because floats are >> > "unreliable"

Re: pytest segfault, not with -v

2021-11-19 Thread MRAB
On 2021-11-19 23:44, Marco Sulla wrote: On Fri, 19 Nov 2021 at 20:38, MRAB wrote: On 2021-11-19 17:48, Marco Sulla wrote: > I have a battery of tests done with pytest. My tests break with a > segfault if I run them normally. If I run them using pytest -v, the > segfault does not happen. > > Wh

Re: pytest segfault, not with -v

2021-11-19 Thread Marco Sulla
On Fri, 19 Nov 2021 at 20:38, MRAB wrote: > > On 2021-11-19 17:48, Marco Sulla wrote: > > I have a battery of tests done with pytest. My tests break with a > > segfault if I run them normally. If I run them using pytest -v, the > > segfault does not happen. > > > > What could cause this quantical

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-19 Thread dn via Python-list
On 20/11/2021 10.21, Chris Angelico wrote: > On Sat, Nov 20, 2021 at 7:39 AM dn via Python-list > wrote: >>> 0.3 + 0.3 + 0.3 == 0.9 False >>> >>> That's because 0.3 is not 3/10. It's not because floats are >>> "unreliable" or "inaccurate". It's because the ones you're entering >>> are n

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-19 Thread Chris Angelico
On Sat, Nov 20, 2021 at 9:07 AM Ben Bacarisse wrote: > > Chris Angelico writes: > > > On Sat, Nov 20, 2021 at 5:08 AM ast wrote: > > >> >>> 0.3 + 0.3 + 0.3 == 0.9 > >> False > > > > That's because 0.3 is not 3/10. It's not because floats are > > "unreliable" or "inaccurate". It's because the on

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-19 Thread Ben Bacarisse
Chris Angelico writes: > On Sat, Nov 20, 2021 at 5:08 AM ast wrote: >> >>> 0.3 + 0.3 + 0.3 == 0.9 >> False > > That's because 0.3 is not 3/10. It's not because floats are > "unreliable" or "inaccurate". It's because the ones you're entering > are not what you think they are. > > When will peop

Re: frozenset can be altered by |=

2021-11-19 Thread MRAB
On 2021-11-19 21:11, Marco Sulla wrote: (venv_3_10) marco@buzz:~$ python Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18) [GCC 10.1.1 20200718] on linux Type "help", "copyright", "credits" or "license" for more information. a = frozenset((3, 4)) a frozenset({3, 4}) a |= {5,}

Re: frozenset can be altered by |=

2021-11-19 Thread Marco Sulla
Mh. Now I'm thinking that I've done a = "Marco " a += "Sulla" many times without bothering. On Fri, 19 Nov 2021 at 22:22, Chris Angelico wrote: > > On Sat, Nov 20, 2021 at 8:16 AM Chris Angelico wrote: > > > > On Sat, Nov 20, 2021 at 8:13 AM Marco Sulla > > wrote: > > > > > > (venv_3_10) marc

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-19 Thread Chris Angelico
On Sat, Nov 20, 2021 at 7:39 AM dn via Python-list wrote: > >> >>> 0.3 + 0.3 + 0.3 == 0.9 > >> False > > > > That's because 0.3 is not 3/10. It's not because floats are > > "unreliable" or "inaccurate". It's because the ones you're entering > > are not what you think they are. > > > > When will p

Re: frozenset can be altered by |=

2021-11-19 Thread Chris Angelico
On Sat, Nov 20, 2021 at 8:16 AM Chris Angelico wrote: > > On Sat, Nov 20, 2021 at 8:13 AM Marco Sulla > wrote: > > > > (venv_3_10) marco@buzz:~$ python > > Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18) > > [GCC 10.1.1 20200718] on linux > > Type "help", "copyright", "credits"

Re: frozenset can be altered by |=

2021-11-19 Thread Chris Angelico
On Sat, Nov 20, 2021 at 8:13 AM Marco Sulla wrote: > > (venv_3_10) marco@buzz:~$ python > Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18) > [GCC 10.1.1 20200718] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> a = frozenset((3, 4)) > >>> a

frozenset can be altered by |=

2021-11-19 Thread Marco Sulla
(venv_3_10) marco@buzz:~$ python Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18) [GCC 10.1.1 20200718] on linux Type "help", "copyright", "credits" or "license" for more information. >>> a = frozenset((3, 4)) >>> a frozenset({3, 4}) >>> a |= {5,} >>> a frozenset({3, 4, 5}) -- ht

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-19 Thread dn via Python-list
On 20/11/2021 09.17, Chris Angelico wrote: > On Sat, Nov 20, 2021 at 5:08 AM ast wrote: >> Le 19/11/2021 à 03:51, MRAB a écrit : >>> On 2021-11-19 02:40, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2021-11-18 at 23:16:32 -0300, René Silva Valdés wrote: > Working with floats i notic

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-19 Thread Chris Angelico
On Sat, Nov 20, 2021 at 5:08 AM ast wrote: > > Le 19/11/2021 à 03:51, MRAB a écrit : > > On 2021-11-19 02:40, 2qdxy4rzwzuui...@potatochowder.com wrote: > >> On 2021-11-18 at 23:16:32 -0300, > >> René Silva Valdés wrote: > >> > >>> Hello, I would like to report the following issue: > >>> > >>> Wor

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-19 Thread Mats Wichmann
On 11/18/21 19:40, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2021-11-18 at 23:16:32 -0300, René Silva Valdés wrote: Hello, I would like to report the following issue: Working with floats i noticed that: int(23.99/12) returns 1, and int(23.999/12) returns 2 This im

Re: import question

2021-11-19 Thread dn via Python-list
On 20/11/2021 03.38, lucas wrote: > ok. all good advice. thank you for that. and with all that I've decided > what to do. > > I'm going to close off any server-side python access so that I don't expose > my server or the file system to vulnerabilities and/or wonton attacks. I am > building

Re: pytest segfault, not with -v

2021-11-19 Thread MRAB
On 2021-11-19 17:48, Marco Sulla wrote: I have a battery of tests done with pytest. My tests break with a segfault if I run them normally. If I run them using pytest -v, the segfault does not happen. What could cause this quantical phenomenon? Are you testing an extension that you're compiling?

Re: getting source code line of error?

2021-11-19 Thread Marco Sulla
Have you tried the logger module and the format options? On Fri, 19 Nov 2021 at 19:09, Ulli Horlacher wrote: > > I am trying to get the source code line of the last error. > I know traceback.format_exc() but this contains much more information, e.g.: > > Traceback (most recent call last): > Fil

Re: import question

2021-11-19 Thread lucas
ok. all good advice. thank you for that. and with all that I've decided what to do. I'm going to close off any server-side python access so that I don't expose my server or the file system to vulnerabilities and/or wonton attacks. I am building a site for education and what I will configure

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-19 Thread ast
Le 19/11/2021 à 12:43, ast a écrit : Le 19/11/2021 à 03:51, MRAB a écrit : On 2021-11-19 02:40, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2021-11-18 at 23:16:32 -0300, René Silva Valdés wrote: Hello, I would like to report the following issue: Working with floats i noticed that: int(23.

Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-19 Thread ast
Le 19/11/2021 à 03:51, MRAB a écrit : On 2021-11-19 02:40, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2021-11-18 at 23:16:32 -0300, René Silva Valdés wrote: Hello, I would like to report the following issue: Working with floats i noticed that: int(23.99/12) returns 1, and int(

getting source code line of error?

2021-11-19 Thread Ulli Horlacher
I am trying to get the source code line of the last error. I know traceback.format_exc() but this contains much more information, e.g.: Traceback (most recent call last): File "./error.py", line 18, in main x=1/0 ZeroDivisionError: division by zero I could extract the source code line with

pytest segfault, not with -v

2021-11-19 Thread Marco Sulla
I have a battery of tests done with pytest. My tests break with a segfault if I run them normally. If I run them using pytest -v, the segfault does not happen. What could cause this quantical phenomenon? -- https://mail.python.org/mailman/listinfo/python-list

Re: get_axes not present?

2021-11-19 Thread Mahmood Naderan via Python-list
>And what is the result of plot()?  Is it a valid object, or is it None? Well the error happens on the plot() line. I tried to print some information like this:     print("axes=", axes)     print("axes[0]=", axes[0])     print("cnt=", cnt)     print("row=", row)     ax1 = row.plot( fontsize=fon

Re: import question

2021-11-19 Thread Mats Wichmann
On 11/18/21 21:00, Dan Stromberg wrote: On Thu, Nov 18, 2021 at 6:19 PM Chris Angelico wrote: On Fri, Nov 19, 2021 at 11:24 AM Dan Stromberg wrote: On Thu, Nov 18, 2021 at 12:21 PM Chris Angelico wrote: If you're trying to make a Python-in-Python sandbox, I recommend not. Instead, use