Re: Accessing parent objects

2018-03-24 Thread Steven D'Aprano
On Sat, 24 Mar 2018 20:08:47 -0700, Rick Johnson wrote: > After sending my response to Steven, i began to ponder why i had > rejected Python's super (because, after all, it's been a few years now, > and frankly, i forgot), and i realized it was more a matter of > consistency. > > You see, Tkinter

Re: Accessing parent objects

2018-03-24 Thread Rick Johnson
On Saturday, March 24, 2018 at 9:29:02 PM UTC-5, Chris Angelico wrote: > So tell me, how do these other (beautifully intuitive) > languages handle multiple inheritance? I'm sure it's really > easy to make super() work when there's exactly one > superclass that you can lock in at compile time. Afte

Re: Accessing parent objects

2018-03-24 Thread Chris Angelico
On Sun, Mar 25, 2018 at 1:20 PM, Rick Johnson wrote: > On Saturday, March 24, 2018 at 6:57:29 PM UTC-5, Steven D'Aprano wrote: >> There's nothing wrong with super() in Python 2. You just >> have to understand what you're doing. It's still the right >> solution for doing inheritance the right way.

Re: Accessing parent objects

2018-03-24 Thread Rick Johnson
On Saturday, March 24, 2018 at 6:57:29 PM UTC-5, Steven D'Aprano wrote: > There's nothing wrong with super() in Python 2. You just > have to understand what you're doing. It's still the right > solution for doing inheritance the right way. The problem is, Python's super is not intuitive. And i'd

Re: Entering a very large number

2018-03-24 Thread Steven D'Aprano
On Sun, 25 Mar 2018 00:05:56 +0100, Peter J. Holzer wrote: [...] >> yes, good idea > > Not if you want to avoid that string to int conversion (as you stated). > > That is still there, but in addition you now split the string into a > list and then join the list into a different string. I'm glad

Re: Accessing parent objects

2018-03-24 Thread Steven D'Aprano
On Sat, 24 Mar 2018 13:31:13 -0700, Rick Johnson wrote: > On Saturday, March 24, 2018 at 1:20:24 PM UTC-5, D'Arcy Cain wrote: [...] >> I tried various forms of super() but that didn't seem to work. Define "doesn't see to work". > Python's super (at least <= 2.x) is notoriously blinkered. I avoi

Re: Entering a very large number

2018-03-24 Thread Peter J. Holzer
On 2018-03-23 14:12:27 +0100, ast wrote: > Le 23/03/2018 à 13:55, Wolfgang Maier a écrit : > > On 03/23/2018 01:30 PM, Wolfgang Maier wrote: > > > On 03/23/2018 01:16 PM, ast wrote: [quoted from the first mail in this thread:] > > > > It works but is it not optimal since there is a > > > > string

Re: Since when builtin dict preserve key order?

2018-03-24 Thread Chris Angelico
On Sun, Mar 25, 2018 at 8:52 AM, Arkadiusz Bulski wrote: > What exactly do you mean its present but not guaranteed? Do you mean its a > property of CPython 3.6 implementation but not Python as a standard? Correct. The implementation was done in CPython (basically lifting it from PyPy, AIUI), and

Re: Since when builtin dict preserve key order?

2018-03-24 Thread Arkadiusz Bulski
What exactly do you mean its present but not guaranteed? Do you mean its a property of CPython 3.6 implementation but not Python as a standard? sob., 24 mar 2018 o 21:33 użytkownik Dan Stromberg napisał: > On Fri, Mar 23, 2018 at 9:34 PM, Arkadiusz Bulski > wrote: > > I already asked on PYPY an

Re: Since when builtin dict preserve key order?

2018-03-24 Thread Dan Stromberg
On Fri, Mar 23, 2018 at 9:34 PM, Arkadiusz Bulski wrote: > I already asked on PYPY and they confirmed that any version of pypy, > including 2.7, has dict preserving insertion order. I am familiar with > ordered **kw which was introduced in 3.6 but I also heard that builtin dict > preserves order s

Re: Accessing parent objects

2018-03-24 Thread Rick Johnson
On Saturday, March 24, 2018 at 1:20:24 PM UTC-5, D'Arcy Cain wrote: > I'm not even sure how to describe what I am trying to do > which perhaps indicates that what I am trying to do is the > wrong solution to my problem in the first place but let me > give it a shot. Look at the following code. >

Re: Best practice for managing secrets (passwords, private keys) used by Python scripts running as daemons

2018-03-24 Thread Chris Angelico
On Sun, Mar 25, 2018 at 7:23 AM, Thomas Jollans wrote: > On 24/03/18 20:41, Chris Angelico wrote: >> On Sun, Mar 25, 2018 at 4:24 AM, Peter J. Holzer wrote: >>> On 2018-03-23 11:50:52 -0700, Dan Stromberg wrote: I'd put them in a file with access to the daemon.. Putting credentials

Re: Best practice for managing secrets (passwords, private keys) used by Python scripts running as daemons

2018-03-24 Thread Thomas Jollans
On 24/03/18 20:41, Chris Angelico wrote: > On Sun, Mar 25, 2018 at 4:24 AM, Peter J. Holzer wrote: >> On 2018-03-23 11:50:52 -0700, Dan Stromberg wrote: >>> I'd put them in a file with access to the daemon.. >>> >>> Putting credentials in an environment variable is insecure on Linux, >>> because p

Re: Accessing parent objects

2018-03-24 Thread Chris Angelico
On Sun, Mar 25, 2018 at 5:14 AM, D'Arcy Cain wrote: > I'm not even sure how to describe what I am trying to do which perhaps > indicates that what I am trying to do is the wrong solution to my > problem in the first place but let me give it a shot. Look at the > following code. > > class C1(dict)

Re: Putting Unicode characters in JSON

2018-03-24 Thread Peter J. Holzer
On 2018-03-25 06:30:54 +1100, Chris Angelico wrote: > On Sun, Mar 25, 2018 at 3:35 AM, Peter J. Holzer wrote: > > On 2018-03-24 11:21:09 +1100, Chris Angelico wrote: > >> If the database has been configured to use UTF-8 (as mentioned, that's > >> "utf8mb4" in MySQL), you won't get that byte sequen

Re: Best practice for managing secrets (passwords, private keys) used by Python scripts running as daemons

2018-03-24 Thread Chris Angelico
On Sun, Mar 25, 2018 at 4:24 AM, Peter J. Holzer wrote: > On 2018-03-23 11:50:52 -0700, Dan Stromberg wrote: >> I'd put them in a file with access to the daemon.. >> >> Putting credentials in an environment variable is insecure on Linux, >> because ps auxwwe lists environment variables. > > But on

Re: Putting Unicode characters in JSON

2018-03-24 Thread Chris Angelico
On Sun, Mar 25, 2018 at 3:35 AM, Peter J. Holzer wrote: > On 2018-03-24 11:21:09 +1100, Chris Angelico wrote: >> If the database has been configured to use UTF-8 (as mentioned, that's >> "utf8mb4" in MySQL), you won't get that byte sequence back. You'll get >> back valid UTF-8. > > Actually (with

Re: Accessing parent objects

2018-03-24 Thread Peter Otten
D'Arcy Cain wrote: > I'm not even sure how to describe what I am trying to do which perhaps > indicates that what I am trying to do is the wrong solution to my > problem in the first place but let me give it a shot. Look at the > following code. > > class C1(dict): > class C2(object): > de

Re: Pip Version Confusion

2018-03-24 Thread Tim Johnson
* Tim Johnson [180324 10:32]: > * Steven D'Aprano [180324 08:29]: > > On Sat, 24 Mar 2018 07:40:17 -0800, Tim Johnson wrote: > > > > > I'm on Ubuntu 16.04. > > > > > > I'm getting the following message from pip: > > > > > > You are using pip version 8.1.1, however version 9.0.3 is available. Y

Re: Pip Version Confusion

2018-03-24 Thread Tim Johnson
* Steven D'Aprano [180324 08:29]: > On Sat, 24 Mar 2018 07:40:17 -0800, Tim Johnson wrote: > > > I'm on Ubuntu 16.04. > > > > I'm getting the following message from pip: > > > > You are using pip version 8.1.1, however version 9.0.3 is available. You > > should consider upgrading via the 'pip i

Accessing parent objects

2018-03-24 Thread D'Arcy Cain
I'm not even sure how to describe what I am trying to do which perhaps indicates that what I am trying to do is the wrong solution to my problem in the first place but let me give it a shot. Look at the following code. class C1(dict): class C2(object): def f(self): return X['field']

Re: Best practice for managing secrets (passwords, private keys) used by Python scripts running as daemons

2018-03-24 Thread Peter J. Holzer
On 2018-03-23 11:50:52 -0700, Dan Stromberg wrote: > I'd put them in a file with access to the daemon.. > > Putting credentials in an environment variable is insecure on Linux, > because ps auxwwe lists environment variables. But only those of your own processes. So both methods are about equally

Re: Putting Unicode characters in JSON

2018-03-24 Thread Peter J. Holzer
On 2018-03-24 11:21:09 +1100, Chris Angelico wrote: > On Sat, Mar 24, 2018 at 11:11 AM, Steven D'Aprano > wrote: > > On Fri, 23 Mar 2018 07:46:16 -0700, Tobiah wrote: > >> If I changed my database tables to all be UTF-8 would this work cleanly > >> without any decoding? > > > > Not reliably or saf

Re: Pip Version Confusion

2018-03-24 Thread Steven D'Aprano
On Sat, 24 Mar 2018 07:40:17 -0800, Tim Johnson wrote: > I'm on Ubuntu 16.04. > > I'm getting the following message from pip: > > You are using pip version 8.1.1, however version 9.0.3 is available. You > should consider upgrading via the 'pip install --upgrade pip' command. [...] > Not sure how

Pip Version Confusion

2018-03-24 Thread Tim Johnson
I'm on Ubuntu 16.04. I'm getting the following message from pip: You are using pip version 8.1.1, however version 9.0.3 is available. You should consider upgrading via the 'pip install --upgrade pip' command. # But then I get this : tim@linus:~/Downloads$ which pip /home/tim/.local/bin/pip # an

Re: Since when builtin dict preserve key order?

2018-03-24 Thread Marko Rauhamaa
Chris Angelico : > On Sat, Mar 24, 2018 at 10:48 PM, Marko Rauhamaa wrote: >> I take it, then, that the Language Specification follows CPython's >> version numbering. I wonder how other Python implementations declare >> their standards compliance. > > Have you thought to look? > > $ pypy > Python

Re: Since when builtin dict preserve key order?

2018-03-24 Thread Chris Angelico
On Sat, Mar 24, 2018 at 10:48 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Sat, Mar 24, 2018 at 7:48 PM, Marko Rauhamaa wrote: >>> Is that part of the Python Language Specification? If not, it >>> shouldn't be exploited in application programs. >> >> Yes, it is; but the language spec wasn

Re: Since when builtin dict preserve key order?

2018-03-24 Thread Marko Rauhamaa
Chris Angelico : > On Sat, Mar 24, 2018 at 7:48 PM, Marko Rauhamaa wrote: >> Is that part of the Python Language Specification? If not, it >> shouldn't be exploited in application programs. > > Yes, it is; but the language spec wasn't locked in quite as soon as > the functionality was. So you may

Re: Since when builtin dict preserve key order?

2018-03-24 Thread Serhiy Storchaka
24.03.18 10:48, Marko Rauhamaa пише: Chris Angelico : On Sat, Mar 24, 2018 at 3:34 PM, Arkadiusz Bulski wrote: I already asked on PYPY and they confirmed that any version of pypy, including 2.7, has dict preserving insertion order. I am familiar with ordered **kw which was introduced in 3.6 bu

Re: Since when builtin dict preserve key order?

2018-03-24 Thread Chris Angelico
On Sat, Mar 24, 2018 at 7:48 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Sat, Mar 24, 2018 at 3:34 PM, Arkadiusz Bulski >> wrote: >>> I already asked on PYPY and they confirmed that any version of pypy, >>> including 2.7, has dict preserving insertion order. I am familiar >>> with ordere

Re: Since when builtin dict preserve key order?

2018-03-24 Thread Marko Rauhamaa
Chris Angelico : > On Sat, Mar 24, 2018 at 3:34 PM, Arkadiusz Bulski > wrote: >> I already asked on PYPY and they confirmed that any version of pypy, >> including 2.7, has dict preserving insertion order. I am familiar >> with ordered **kw which was introduced in 3.6 but I also heard that >> buil