Re: Connecting python to DB2 database

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 1:26 PM DFS wrote: > > On 9/3/2021 9:50 AM, Chris Angelico wrote: > > On Fri, Sep 3, 2021 at 11:37 PM DFS wrote: > >> > >> On 9/3/2021 1:47 AM, Chris Angelico wrote: > >>> On Fri, Sep 3, 2021 at 3:42 PM DFS wrote: > > Having a problem with the DB2 connector > >>>

Re: on floating-point numbers

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 12:58 PM Greg Ewing wrote: > > On 5/09/21 2:42 am, Hope Rouselle wrote: > > Here's what I did on this case. The REPL is telling me that > > > >7.23 = 2035064081618043/281474976710656 > > If 7.23 were exactly representable, you would have got > 723/1000. > > Contrast thi

Re: on floating-point numbers

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 12:55 PM Hope Rouselle wrote: > > Julio Di Egidio writes: > > > On Thursday, 2 September 2021 at 16:51:24 UTC+2, Christian Gollwitzer wrote: > >> Am 02.09.21 um 16:49 schrieb Julio Di Egidio: > >> > On Thursday, 2 September 2021 at 16:41:38 UTC+2, Peter Pearson wrote: > >>

Re: on floating-point numbers

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 12:44 PM Hope Rouselle wrote: > > Chris Angelico writes: > > > On Fri, Sep 3, 2021 at 4:29 AM Hope Rouselle wrote: > >> > >> Just sharing a case of floating-point numbers. Nothing needed to be > >> solved or to be figured out. Just bringing up conversation. > >> > >> (*)

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 12:39 PM Alan Gauld via Python-list wrote: > > On 03/09/2021 18:37, Chris Angelico wrote: > > Without DST the schools opened in the dark so all the kids > had to travel to school in the dark and the number of > traffic accidents while crossing roads jumped. >

Re: on floating-point numbers

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 1:04 PM Hope Rouselle wrote: > The same question in other words --- what's a trivial way for the REPL > to show me such cycles occur? > > >> 7.23.as_integer_ratio() > >>> (2035064081618043, 281474976710656) > > Here's what I did on this case. The REPL is telling me that

Re: Problem with python

2021-09-04 Thread Grant Edwards
On 2021-09-04, Peter J. Holzer wrote: > On 2021-09-04 14:29:47 -0500, Igor Korot wrote: >> Will this syntax work in python 2? > > Yes. It's just a redundant pair of parentheses. Not really. With the parens, it doesn't produce the same results in 2.x unless you import the print function from the f

Re: Help me split a string into elements

2021-09-04 Thread Neil
DFS wrote: > Typical cases: > lines = [('one\ntwo\nthree\n')] > print(str(lines[0]).splitlines()) > ['one', 'two', 'three'] > > lines = [('one two three\n')] > print(str(lines[0]).split()) > ['one', 'two', 'three'] > > > That's the result I'm wanting, but I get data in a slightly differen

Re: on floating-point numbers

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 12:50 PM Hope Rouselle wrote: > > Christian Gollwitzer writes: > > > Am 02.09.21 um 15:51 schrieb Hope Rouselle: > >> Just sharing a case of floating-point numbers. Nothing needed to be > >> solved or to be figured out. Just bringing up conversation. > >> (*) An introduct

Re: Problem with python

2021-09-04 Thread Terry Reedy
On 9/4/2021 2:27 PM, Igor Korot wrote: Hi, ALL, [code] igor@WaylandGnome ~/bakefile $ python Python 3.9.6 (default, Aug 8 2021, 17:26:32) [GCC 10.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. from distutils import sysconfig In 3.10, distutils and d.sysc

Re: on floating-point numbers

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 12:48 PM Hope Rouselle wrote: > > Chris Angelico writes: > > > On Fri, Sep 3, 2021 at 4:58 AM Hope Rouselle wrote: > >> > >> Hope Rouselle writes: > >> > >> > Just sharing a case of floating-point numbers. Nothing needed to be > >> > solved or to be figured out. Just br

Re: Connecting python to DB2 database

2021-09-04 Thread DFS
On 9/3/2021 9:50 AM, Chris Angelico wrote: On Fri, Sep 3, 2021 at 11:37 PM DFS wrote: On 9/3/2021 1:47 AM, Chris Angelico wrote: On Fri, Sep 3, 2021 at 3:42 PM DFS wrote: Having a problem with the DB2 connector test.py impor

Re: on floating-point numbers

2021-09-04 Thread Christian Gollwitzer
Am 04.09.21 um 14:48 schrieb Hope Rouselle: Christian Gollwitzer writes: Am 02.09.21 um 15:51 schrieb Hope Rouselle: Just sharing a case of floating-point numbers. Nothing needed to be solved or to be figured out. Just bringing up conversation. (*) An introduction to me I don't understand f

Re: Select columns based on dates - Pandas

2021-09-04 Thread Richard Medina
On Friday, September 3, 2021 at 11:57:12 AM UTC-5, Martin Di Paola wrote: > You may want to reshape the dataset to a tidy format: Pandas works > better with that format. > > Let's assume the following dataset (this is what I understood from your > message): > > In [34]: df = pd.DataFrame({ >

Re: on writing a while loop for rolling two dice

2021-09-04 Thread Hope Rouselle
"Michael F. Stemper" writes: > On 04/09/2021 08.53, Hope Rouselle wrote: >> Chris Angelico writes: > >>> And at this point, it's looking pretty much identical to the for loop >>> version. Ultimately, they're all the same and you can pick and choose >>> elements from each of them. >> I see. That

Re: Problem with python

2021-09-04 Thread Dennis Lee Bieber
On Sat, 4 Sep 2021 22:41:12 +0200, "Peter J. Holzer" declaimed the following: >Python 3 to be time well spent in 2021, especially not to someone who >apparently just wants to report a bug to some unnamed project (whose >maintainers may or may not care about Python2 compatibility). > Give

Re: Problem with python

2021-09-04 Thread Hope Rouselle
Igor Korot writes: > Hi, > Will this syntax work in python 2? If you say print(something) it works in both. So, stick to this syntax. -- https://mail.python.org/mailman/listinfo/python-list

Re: Help me split a string into elements

2021-09-04 Thread DFS
On 9/4/2021 5:55 PM, DFS wrote: Typical cases:  lines = [('one\ntwo\nthree\n')]  print(str(lines[0]).splitlines())  ['one', 'two', 'three']  lines = [('one two three\n')]  print(str(lines[0]).split())  ['one', 'two', 'three'] That's the result I'm wanting, but I get data in a slightly di

Re: on floating-point numbers

2021-09-04 Thread Hope Rouselle
Christian Gollwitzer writes: > Am 04.09.21 um 14:48 schrieb Hope Rouselle: >> Christian Gollwitzer writes: >> >>> Am 02.09.21 um 15:51 schrieb Hope Rouselle: Just sharing a case of floating-point numbers. Nothing needed to be solved or to be figured out. Just bringing up conversatio

Help me split a string into elements

2021-09-04 Thread DFS
Typical cases: lines = [('one\ntwo\nthree\n')] print(str(lines[0]).splitlines()) ['one', 'two', 'three'] lines = [('one two three\n')] print(str(lines[0]).split()) ['one', 'two', 'three'] That's the result I'm wanting, but I get data in a slightly different format: lines = [('one\ntwo\

Re: on floating-point numbers

2021-09-04 Thread Hope Rouselle
Julio Di Egidio writes: [...] >> I, too, lost my patience there. :-) > > As if I didn't know who's trolling... I never trolled you. When we had our conversations in sci.logic, I was Boris Dorestand --- you would remember if you have very good memory. We talked for just a few days, I guess. T

Re: on floating-point numbers

2021-09-04 Thread Hope Rouselle
Hope Rouselle writes: > Greg Ewing writes: > >> On 5/09/21 2:42 am, Hope Rouselle wrote: >>> Here's what I did on this case. The REPL is telling me that >>>7.23 = 2035064081618043/281474976710656 >> >> If 7.23 were exactly representable, you would have got >> 723/1000. >> >> Contrast this w

Re: on floating-point numbers

2021-09-04 Thread Hope Rouselle
Richard Damon writes: > On 9/4/21 9:40 AM, Hope Rouselle wrote: >> Chris Angelico writes: >> >>> On Fri, Sep 3, 2021 at 4:58 AM Hope Rouselle wrote: Hope Rouselle writes: > Just sharing a case of floating-point numbers. Nothing needed to be > solved or to be figured ou

Re: on floating-point numbers

2021-09-04 Thread Hope Rouselle
Greg Ewing writes: > On 5/09/21 2:42 am, Hope Rouselle wrote: >> Here's what I did on this case. The REPL is telling me that >>7.23 = 2035064081618043/281474976710656 > > If 7.23 were exactly representable, you would have got > 723/1000. > > Contrast this with something that *is* exactly rep

Re: on floating-point numbers

2021-09-04 Thread Hope Rouselle
Julio Di Egidio writes: > On Thursday, 2 September 2021 at 15:52:02 UTC+2, Hope Rouselle wrote: > >> I don't understand floating-point numbers from the inside out, but I do >> know how to work with base 2 and scientific notation. So the idea of >> expressing a number as >> >> mantissa * base^

Re: on floating-point numbers

2021-09-04 Thread Greg Ewing
On 5/09/21 2:42 am, Hope Rouselle wrote: Here's what I did on this case. The REPL is telling me that 7.23 = 2035064081618043/281474976710656 If 7.23 were exactly representable, you would have got 723/1000. Contrast this with something that *is* exactly representable: >>> 7.875.as_integer

Re: on writing a while loop for rolling two dice

2021-09-04 Thread Hope Rouselle
"Peter J. Holzer" writes: > On 2021-09-02 11:28:21 -0300, Hope Rouselle wrote: >> dn writes: >> > On 29/08/2021 08.46, Hope Rouselle wrote: >> >> Here's my solution: >> >> >> >> --8<---cut here---start->8--- >> >> def how_many_times(): >> >> x, y = 0, 1 >>

Re: on floating-point numbers

2021-09-04 Thread Hope Rouselle
Julio Di Egidio writes: > On Thursday, 2 September 2021 at 16:51:24 UTC+2, Christian Gollwitzer wrote: >> Am 02.09.21 um 16:49 schrieb Julio Di Egidio: >> > On Thursday, 2 September 2021 at 16:41:38 UTC+2, Peter Pearson wrote: >> >> On Thu, 02 Sep 2021 10:51:03 -0300, Hope Rouselle wrote: >> >

Re: on writing a while loop for rolling two dice

2021-09-04 Thread Hope Rouselle
Chris Angelico writes: > On Fri, Sep 3, 2021 at 4:33 AM Hope Rouselle wrote: >> Yeah. Here's a little context. I came across this by processing a list >> of exercises. (I'm teaching a course --- you know that by now, I >> guess.) So the first thing I observed was the equal volume of work >>

Re: on floating-point numbers

2021-09-04 Thread Richard Damon
On 9/4/21 9:40 AM, Hope Rouselle wrote: > Chris Angelico writes: > >> On Fri, Sep 3, 2021 at 4:58 AM Hope Rouselle wrote: >>> >>> Hope Rouselle writes: >>> Just sharing a case of floating-point numbers. Nothing needed to be solved or to be figured out. Just bringing up conversation.

Re: on floating-point numbers

2021-09-04 Thread Hope Rouselle
Christian Gollwitzer writes: > Am 02.09.21 um 15:51 schrieb Hope Rouselle: >> Just sharing a case of floating-point numbers. Nothing needed to be >> solved or to be figured out. Just bringing up conversation. >> (*) An introduction to me >> I don't understand floating-point numbers from the ins

Re: on floating-point numbers

2021-09-04 Thread Hope Rouselle
Chris Angelico writes: > On Fri, Sep 3, 2021 at 4:58 AM Hope Rouselle wrote: >> >> Hope Rouselle writes: >> >> > Just sharing a case of floating-point numbers. Nothing needed to be >> > solved or to be figured out. Just bringing up conversation. >> > >> > (*) An introduction to me >> > >> > I

Re: on the popularity of loops while and for

2021-09-04 Thread Hope Rouselle
"Peter J. Holzer" writes: > On 2021-08-29 10:04:47 +0100, Barry wrote: >> > I'd like get a statistic of how often each loop is used in practice. >> > >> > I was trying to take a look at the Python's standard libraries --- those >> > included in a standard installation of Python 3.9.6, say ---

Re: on floating-point numbers

2021-09-04 Thread Hope Rouselle
Chris Angelico writes: > On Fri, Sep 3, 2021 at 4:29 AM Hope Rouselle wrote: >> >> Just sharing a case of floating-point numbers. Nothing needed to be >> solved or to be figured out. Just bringing up conversation. >> >> (*) An introduction to me >> >> I don't understand floating-point numbers

Re: on floating-point numbers

2021-09-04 Thread Greg Ewing
On 3/09/21 8:11 pm, Christian Gollwitzer wrote: Unless you have special numbers like NaN or signed zeros etc., a+b=b+a and a*b=b*a holds also for floats. The only exception I'm aware of is for NaNs, and it's kind of pendantic: you can't say that x + NaN == NaN + x, but only because NaNs never c

Re: on perhaps unloading modules?

2021-09-04 Thread Hope Rouselle
Dennis Lee Bieber writes: > On Sun, 22 Aug 2021 16:28:12 -0300, Hope Rouselle > declaimed the following: > > >>That's wild. :-) Was this created by Brian Kernighan? It's hard to >>believe. Oh, I think he wrote AMPL, wasn't it? A Mathematical >>Programming Language, or something like that. > >

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-04 Thread Alan Gauld via Python-list
On 03/09/2021 18:37, Chris Angelico wrote: Without DST the schools opened in the dark so all the kids had to travel to school in the dark and the number of traffic accidents while crossing roads jumped. > > Are you saying that you had DST in winter, or that, when summer *and* > DST

CPython / Decimal and bit length of value.

2021-09-04 Thread Nacnud Nac via Python-list
Hi, Is there a quick way to get the number of bits required to store the value in a Decimal class?  What obvious thing am I missing? I'm working with really large integers, say, in the order of 5_000_000 of ASCII base 10 digits.  It seems the function mpd_sizeinbase would be a nice thing to be ab

Re: on floating-point numbers

2021-09-04 Thread jak
Il 03/09/2021 14:45, Chris Angelico ha scritto: I believe the definition of "accurate" here is that, if you take all of the real numbers represented by those floats, add them all together with mathematical accuracy, and then take the nearest representable float, that will be the exact value that

How to include insertion order in dict equality

2021-09-04 Thread Terry Reedy
In https://bugs.python.org/issue45093, Michael Rans suggested adding a dict method that would include the insertion order in comparing dicts for equality. He wanted this for testing. The proposal is rejected because there are already multiple good methods. To make them more visible and search

Re: on writing a while loop for rolling two dice

2021-09-04 Thread Michael F. Stemper
On 04/09/2021 08.53, Hope Rouselle wrote: Chris Angelico writes: And at this point, it's looking pretty much identical to the for loop version. Ultimately, they're all the same and you can pick and choose elements from each of them. I see. That's why C must have added the do-while, but yea

[RELEASE] Python 3.7.12 and 3.6.15 security updates now available

2021-09-04 Thread Ned Deily
Python 3.7.12 and 3.6.15, the lastest security fix rollups for Python 3.7 and Python 3.6, are now available. You can find the release files, links to the changelogs, and more information here: https://www.python.org/downloads/release/python-3712/ https://www.python.org/downloads/release/py

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-04 Thread Peter J. Holzer
On 2021-09-04 21:48:14 +0200, Peter J. Holzer wrote: > On 2021-09-02 08:32:36 +0100, Alan Gauld via Python-list wrote: > > On 31/08/2021 22:32, Chris Angelico wrote: > > > If we could abolish DST world-wide, life would be far easier. All the > > > rest of it would be easy enough to handle. > > We t

Re: Problem with python

2021-09-04 Thread Peter J. Holzer
On 2021-09-04 21:07:11 +0100, Rob Cliffe via Python-list wrote: > Well, up to a point. > In Python 2 the output from >     print 1, 2 > is '1 2' > In Python 3 if you add brackets: >     print(1, 2) > the output is the same. > But if you transplant that syntax back into Python 2, the output from >  

Re: Trouble propagating logging configuration

2021-09-04 Thread Peter J. Holzer
On 2021-09-02 09:06:53 +0200, Loris Bennett wrote: > Thanks Peter and Dieter for all the help. I have finally figured out > what my problem was. If in a module 'mylibs.mylib' I have > > import logging > > logger = logging.getLogger(__name__) > > and in my main script have > > import log

Re: Problem with python

2021-09-04 Thread Rob Cliffe via Python-list
Well, up to a point. In Python 2 the output from     print 1, 2 is '1 2' In Python 3 if you add brackets:     print(1, 2) the output is the same. But if you transplant that syntax back into Python 2, the output from     print(1, 2) is '(1, 2)'.  The brackets have turned two separate items into a s

Re: Problem with python

2021-09-04 Thread Peter J. Holzer
On 2021-09-04 14:29:47 -0500, Igor Korot wrote: > Will this syntax work in python 2? Yes. It's just a redundant pair of parentheses. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stros

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-04 Thread Peter J. Holzer
On 2021-09-02 08:32:36 +0100, Alan Gauld via Python-list wrote: > On 31/08/2021 22:32, Chris Angelico wrote: > > If we could abolish DST world-wide, life would be far easier. All the > > rest of it would be easy enough to handle. > We tried that in the UK for 2 years back in the '70s and very > qui

Re: Problem with python

2021-09-04 Thread Igor Korot
Hi, Will this syntax work in python 2? Thank you. On Sat, Sep 4, 2021 at 1:52 PM dn via Python-list wrote: > > On 05/09/2021 06.27, Igor Korot wrote: > > Hi, ALL, > > > > [code] > > igor@WaylandGnome ~/bakefile $ python > > Python 3.9.6 (default, Aug 8 2021, 17:26:32) > > [GCC 10.3.0] on linux

Re: Problem with python

2021-09-04 Thread Igor Korot
Thx guys. I submitted a bug report for the project that uses it. On Sat, Sep 4, 2021 at 1:42 PM Joel Goldstick wrote: > > On Sat, Sep 4, 2021 at 2:29 PM Igor Korot wrote: > > > > Hi, ALL, > > > > [code] > > igor@WaylandGnome ~/bakefile $ python > > Python 3.9.6 (default, Aug 8 2021, 17:26:32) >

Re: Problem with python

2021-09-04 Thread dn via Python-list
On 05/09/2021 06.27, Igor Korot wrote: > Hi, ALL, > > [code] > igor@WaylandGnome ~/bakefile $ python > Python 3.9.6 (default, Aug 8 2021, 17:26:32) > [GCC 10.3.0] on linux > Type "help", "copyright", "credits" or "license" for more information. from distutils import sysconfig print sysc

Re: Problem with python

2021-09-04 Thread Mats Wichmann
On 9/4/21 12:27 PM, Igor Korot wrote: Hi, ALL, [code] igor@WaylandGnome ~/bakefile $ python Python 3.9.6 (default, Aug 8 2021, 17:26:32) [GCC 10.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. from distutils import sysconfig print sysconfig.get_python_inc()

Re: Problem with python

2021-09-04 Thread Joel Goldstick
On Sat, Sep 4, 2021 at 2:29 PM Igor Korot wrote: > > Hi, ALL, > > [code] > igor@WaylandGnome ~/bakefile $ python > Python 3.9.6 (default, Aug 8 2021, 17:26:32) > [GCC 10.3.0] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> from distutils import sysconfig >

Problem with python

2021-09-04 Thread Igor Korot
Hi, ALL, [code] igor@WaylandGnome ~/bakefile $ python Python 3.9.6 (default, Aug 8 2021, 17:26:32) [GCC 10.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from distutils import sysconfig >>> print sysconfig.get_python_inc() File "", line 1 print sysc

Re: urgent

2021-09-04 Thread Abdur-Rahmaan Janhangeer
You need an IDE Check out: PyCharm Wing IDE Spyder ^^ Very few people use the in-built IDE -- https://mail.python.org/mailman/listinfo/python-list

Re: urgent

2021-09-04 Thread Peter J. Holzer
On 2021-09-02 09:56:38 -0500, Michael F. Stemper wrote: > On 31/08/2021 18.02, Barry wrote: > > The big problem with >>> is that it means a third level quote in > > email clients. So when people cut-n-paste REPL output it’s formatted > > badly by some > > email clients. A prompt that avoided that i

Re: on the popularity of loops while and for

2021-09-04 Thread Peter J. Holzer
On 2021-08-29 10:04:47 +0100, Barry wrote: > > I'd like get a statistic of how often each loop is used in practice. > > > > I was trying to take a look at the Python's standard libraries --- those > > included in a standard installation of Python 3.9.6, say --- to see > > which loops are more of

Re: on writing a while loop for rolling two dice

2021-09-04 Thread Peter J. Holzer
On 2021-09-02 11:28:21 -0300, Hope Rouselle wrote: > dn writes: > > On 29/08/2021 08.46, Hope Rouselle wrote: > >> Here's my solution: > >> > >> --8<---cut here---start->8--- > >> def how_many_times(): > >> x, y = 0, 1 > >> c = 0 > >> while x != y: > >>