Re: Strange problem with pip2

2018-03-01 Thread dieter
Cecil Westerhof writes: > There are three pip2 packages that should be updated: > apsw (3.13.0.post1) - Latest: 3.9.2.post1 [sdist] > mysql-utilities (1.6.4) - Latest: 1.4.3 [sdist] > pygobject (3.22.0) - Latest: 3.27.4 [sdist] > > But the strange thing is that the installed version i

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Serhiy Storchaka
02.03.18 02:49, Rick Johnson пише: This is true, but it does not answer the challenge directly because function CRs are a consequence of Python _internals_ *NOT* consequences of a custom class written by a programmer which references itself _explicitly_. This doesn't matter. You question was "C

Homebrew changed default Python to python 3!

2018-03-01 Thread INADA Naoki
https://github.com/Homebrew/homebrew-core/pull/24604 /use/local/bin/python is symlink to python3. vim is built with python3. You can install it from bottle. Thanks to Homebrew maintainers!! -- https://mail.python.org/mailman/listinfo/python-list

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Chris Angelico
On Fri, Mar 2, 2018 at 4:46 PM, Ian Kelly wrote: > On Thu, Mar 1, 2018 at 10:35 PM, Chris Angelico wrote: >> On Fri, Mar 2, 2018 at 4:16 PM, Ian Kelly wrote: >>> On Wed, Feb 28, 2018 at 8:00 PM, Chris Angelico wrote: Not off hand, but I can provide an EXTREMELY real-world example of a

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Steven D'Aprano
On Thu, 01 Mar 2018 22:46:56 -0700, Ian Kelly wrote: > On Thu, Mar 1, 2018 at 10:35 PM, Chris Angelico > wrote: >> On Fri, Mar 2, 2018 at 4:16 PM, Ian Kelly >> wrote: >>> On Wed, Feb 28, 2018 at 8:00 PM, Chris Angelico >>> wrote: Not off hand, but I can provide an EXTREMELY real-world exam

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Ian Kelly
On Thu, Mar 1, 2018 at 10:35 PM, Chris Angelico wrote: > On Fri, Mar 2, 2018 at 4:16 PM, Ian Kelly wrote: >> On Wed, Feb 28, 2018 at 8:00 PM, Chris Angelico wrote: >>> Not off hand, but I can provide an EXTREMELY real-world example of a >>> fairly tight loop: exceptions. An exception has a refer

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Chris Angelico
On Fri, Mar 2, 2018 at 4:16 PM, Ian Kelly wrote: > On Wed, Feb 28, 2018 at 8:00 PM, Chris Angelico wrote: >> On Thu, Mar 1, 2018 at 1:46 PM, Rick Johnson >> wrote: >>> On Wednesday, February 28, 2018 at 5:02:17 PM UTC-6, Chris Angelico wrote: >>> Here's one example: reference cycles. When d

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Ian Kelly
On Wed, Feb 28, 2018 at 9:00 PM, ROGER GRAYDON CHRISTMAN wrote: > > On Wed, Feb 28, 2018, Rick Johnson wrote: > > On Wednesday, February 28, 2018 at 5:02:17 PM UTC-6, Chris Angelico wrote: >> >>> Here's one example: reference cycles. When do they get detected? >>> Taking a really simple situation:

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Rustom Mody
On Friday, March 2, 2018 at 10:05:41 AM UTC+5:30, Steven D'Aprano wrote: > On Thu, 01 Mar 2018 16:26:47 -0800, ooomzay wrote: > > >> >> When does the destination file get closed? > >> > > >> > When you execute:- > >> > > >> >del dst > >> > > >> > or:- > >> > > >> >dst = something_else > >>

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Ian Kelly
On Wed, Feb 28, 2018 at 8:00 PM, Chris Angelico wrote: > On Thu, Mar 1, 2018 at 1:46 PM, Rick Johnson > wrote: >> On Wednesday, February 28, 2018 at 5:02:17 PM UTC-6, Chris Angelico wrote: >> >>> Here's one example: reference cycles. When do they get detected? >>> Taking a really simple situation

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Steven D'Aprano
On Thu, 01 Mar 2018 16:26:47 -0800, ooomzay wrote: >> >> When does the destination file get closed? >> > >> > When you execute:- >> > >> >del dst >> > >> > or:- >> > >> >dst = something_else >> >> What if you don't? > > Then the resource will remain open until your script exits at which

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Rick Johnson
On Thursday, March 1, 2018 at 6:10:45 PM UTC-6, Chris Angelico wrote: > On Fri, Mar 2, 2018 at 10:58 AM, Rick Johnson > wrote: > > I don't buy into the religion that _all_ CRs are evil. Those > > who make such claims are dealing in absolutes. And as Obi- > > wan warned Anakin, only a Sith deals in

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Steven D'Aprano
On Thu, 01 Mar 2018 16:49:35 -0800, Rick Johnson wrote: > Remember, the challenge is _not_ simply a matter of circular references > (there is literally tons of Python code out there which creates CRs for > various reasons), no, the challenge is to create a custom class which > references _itself_,

Re: Problem: Need galileo running on debian wheezy

2018-03-01 Thread Gene Heskett
On Thursday 01 March 2018 17:29:27 Wildman via Python-list wrote: > On Thu, 01 Mar 2018 13:44:27 -0500, Gene Heskett wrote: > > I know its supposed to be in the debian stretch repo's. > > > > I've been told to get a fitbit, but they don't support linux of any > > flavor, and that leaves galileo as

Re: Problem: Need galileo running on debian wheezy

2018-03-01 Thread Gene Heskett
On Thursday 01 March 2018 15:31:32 Cousin Stanley wrote: > Gene Heskett wrote: > > I know its supposed to be in the debian stretch repo's. > > > > I've been told to get a fitbit, but they don't support linux > > of any flavor, and that leaves galileo as the possible solution? > > > > So how should

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread INADA Naoki
> > Remember, the challenge is _not_ simply a matter of circular > references (there is literally tons of Python code out there > which creates CRs for various reasons), no, the challenge is > to create a custom class which references _itself_, and then > explain (or demonstrate) how such a thing s

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Rick Johnson
On Thursday, March 1, 2018 at 1:54:40 AM UTC-6, Serhiy Storchaka wrote: [...] > Every global function (or method of global class) creates a > reference cycle. > > def f(): pass > > f.__globals__['f'] is f (Note: This is also a response to dieter) This is true, but it does not answer t

Re: csv module and NULL data byte

2018-03-01 Thread Tim Chase
On 2018-03-01 23:57, John Pote wrote: > On 01/03/2018 01:35, Tim Chase wrote: > > While inelegant, I've "solved" this with a wrapper/generator > > > >f = file(fname, …) > >g = (line.replace('\0', '') for line in f) > I wondered about something like this but thought if there's a way > of a

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread ooomzay
On Friday, March 2, 2018 at 12:14:53 AM UTC, Chris Angelico wrote: > On Fri, Mar 2, 2018 at 11:07 AM, ooomzay wrote: > > On Thursday, March 1, 2018 at 11:59:26 PM UTC, Chris Angelico wrote: > >> On Fri, Mar 2, 2018 at 10:38 AM, ooomzay wrote: > >> > def raii_example(): > >> > > >> > src = RAI

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread MRAB
On 2018-03-01 23:38, ooom...@gmail.com wrote: On Thursday, March 1, 2018 at 12:15:57 AM UTC, Paul Rubin wrote: RAII is similar to Python's "with" statement. So it sounds like OP wants to replace one "malignant carbuncle" with another one. I would like to understand why you think RAII is not

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Chris Angelico
On Fri, Mar 2, 2018 at 11:07 AM, wrote: > On Thursday, March 1, 2018 at 11:59:26 PM UTC, Chris Angelico wrote: >> On Fri, Mar 2, 2018 at 10:38 AM, ooomzay wrote: >> > def raii_example(): >> > >> > src = RAIIFileAccess("src.txt", 'r') >> > dst = RAIIFileAccess("dst.txt", 'w') >> > >> >

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Rick Johnson
On Wednesday, February 28, 2018 at 11:44:39 PM UTC-6, Paul Rubin wrote: > Rick Johnson writes: > > Can you provide a real world example in which you need an > > object which circularly references _itself_? > > DOM trees are a classic example (see the various DOM > modules in the Python stdlib).

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Chris Angelico
On Fri, Mar 2, 2018 at 10:58 AM, Rick Johnson wrote: > I don't buy into the religion that _all_ CRs are evil. Those > who make such claims are dealing in absolutes. And as Obi- > wan warned Anakin, only a Sith deals in absolutes. ;-) So mathematicians are all Sith? ChrisA -- https://mail.python

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread ooomzay
On Thursday, March 1, 2018 at 11:59:26 PM UTC, Chris Angelico wrote: > On Fri, Mar 2, 2018 at 10:38 AM, ooomzay wrote: > > def raii_example(): > > > > src = RAIIFileAccess("src.txt", 'r') > > dst = RAIIFileAccess("dst.txt", 'w') > > > > for line in src: > > dst.write(line) > >

Re: RFC: Proposal: Deterministic Object Destruction (Posting On Python-List Prohibited)

2018-03-01 Thread ooomzay
On Thursday, March 1, 2018 at 11:51:50 PM UTC, Lawrence D’Oliveiro wrote: > On Friday, March 2, 2018 at 12:39:01 PM UTC+13, ooo...@gmail.com wrote: > > class RAIIFileAccess(): > > '''File Access-like Resource using [RAII] idiom''' > > > > ... > > > > def __del__(self): > >

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Rick Johnson
On Wednesday, February 28, 2018 at 10:26:26 PM UTC-6, Steven D'Aprano wrote: > On Wed, 28 Feb 2018 18:46:05 -0800, Rick Johnson wrote: > > > On Wednesday, February 28, 2018 at 5:02:17 PM UTC-6, Chris Angelico > > wrote: > > > >> Here's one example: reference cycles. When do they get detected? Tak

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Chris Angelico
On Fri, Mar 2, 2018 at 10:38 AM, wrote: > def raii_example(): > > src = RAIIFileAccess("src.txt", 'r') > dst = RAIIFileAccess("dst.txt", 'w') > > for line in src: > dst.write(line) > What happens if we make this change? def raii_example(): global dst src = RAIIFileAc

Re: csv module and NULL data byte

2018-03-01 Thread John Pote
On 01/03/2018 01:35, Tim Chase wrote: While inelegant, I've "solved" this with a wrapper/generator f = file(fname, …) g = (line.replace('\0', '') for line in f) I wondered about something like this but thought if there's a way of avoiding the extra step it would keep the execution speed u

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread ooomzay
On Thursday, March 1, 2018 at 12:15:57 AM UTC, Paul Rubin wrote: > RAII is similar to Python's "with" statement. So it sounds like OP > wants to replace one "malignant carbuncle" with another one. I would like to understand why you think RAII is not substantially more pythonic than "With". Bel

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Rick Johnson
On Wednesday, February 28, 2018 at 10:03:56 PM UTC-6, ROGER GRAYDON CHRISTMAN wrote: [...] > If you want something that looks like a real world example, > consider the very common doubly-linked list: > > [ 1 ] <---> [ 2 ] <---> [ 3 ] <--.--> [ N ] > > This is chock-full of reference cycle

Re: csv module and NULL data byte

2018-03-01 Thread John Pote
On 01/03/2018 02:38, Dennis Lee Bieber wrote: On Wed, 28 Feb 2018 23:40:41 +, John Pote declaimed the following:     with open( fname, 'rt', encoding='iso-8859-1' ) as csvfile: Pardon? Has the CSV module changed in the last year or so? Python 3.6 docs say csv reader has to be gi

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Chris Angelico
On Fri, Mar 2, 2018 at 9:49 AM, Rick Johnson wrote: > On Wednesday, February 28, 2018 at 9:00:37 PM UTC-6, Chris Angelico wrote: >> On Thu, Mar 1, 2018 at 1:46 PM, Rick Johnson >> wrote: >> > On Wednesday, February 28, 2018 at 5:02:17 PM UTC-6, Chris Angelico wrote: >> > >> >> Here's one example:

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Rick Johnson
On Wednesday, February 28, 2018 at 9:00:37 PM UTC-6, Chris Angelico wrote: > On Thu, Mar 1, 2018 at 1:46 PM, Rick Johnson > wrote: > > On Wednesday, February 28, 2018 at 5:02:17 PM UTC-6, Chris Angelico wrote: > > > >> Here's one example: reference cycles. When do they get detected? > >> Taking a

Re: RFC: Proposal: Deterministic Object Destruction (Posting On Python-List Prohibited)

2018-03-01 Thread Rob Gaddi
On 03/01/2018 02:24 PM, Lawrence D’Oliveiro wrote: On Thursday, March 1, 2018 at 6:44:39 PM UTC+13, Paul Rubin wrote: DOM trees are a classic example (see the various DOM modules in the Python stdlib). Non-leaf nodes have a list of child nodes, child nodes have pointers back upwards to their pa

Re: Problem: Need galileo running on debian wheezy

2018-03-01 Thread Wildman via Python-list
On Thu, 01 Mar 2018 13:44:27 -0500, Gene Heskett wrote: > I know its supposed to be in the debian stretch repo's. > > I've been told to get a fitbit, but they don't support linux of any > flavor, and that leaves galileo as the possible solution? > > So how should I proceed since the only stretc

Re: Problem: Need galileo running on debian wheezy

2018-03-01 Thread Cousin Stanley
Gene Heskett wrote: > I know its supposed to be in the debian stretch repo's. > > I've been told to get a fitbit, but they don't support linux > of any flavor, and that leaves galileo as the possible solution? > > So how should I proceed since the only stretch machine I have ATM > is an arm64,

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread ooomzay
On Thursday, March 1, 2018 at 12:35:38 PM UTC, Richard Damon wrote: > [snip] > I disagree with the original complaint that these > are always 'errors', if you know you have garbage collection, the > allowance of cycles knowing they will still get cleaned up is a useful > simplification if you do

Problem: Need galileo running on debian wheezy

2018-03-01 Thread Gene Heskett
I know its supposed to be in the debian stretch repo's. I've been told to get a fitbit, but they don't support linux of any flavor, and that leaves galileo as the possible solution? So how should I proceed since the only stretch machine I have ATM is an arm64, aka a rock64. -- Cheers, Gene H

Re: Functions unnecessarily called in Python/pylifecycle.c:_Py_InitializeCore() ?

2018-03-01 Thread Thomas Nyberg
On 03/01/2018 04:58 PM, Ned Batchelder wrote: > This sounds like it could make a good contribution to CPython :) > > --Ned. Thanks for the recommendation. Issue/PR created: https://bugs.python.org/issue32980 https://github.com/python/cpython/pull/5953 Cheers, Thomas -- https://

Re: Strange problem with pip2

2018-03-01 Thread Paul Moore
On 1 March 2018 at 16:32, Dennis Lee Bieber wrote: > Note that a google search shows lots of problems apparently caused by > the --single-version-externally-managed option. --single-version-externally-managed is how pip calls setuptools, and is required. It doesn't cause any problems the

Re: Functions unnecessarily called in Python/pylifecycle.c:_Py_InitializeCore() ?

2018-03-01 Thread Ned Batchelder
On 3/1/18 7:40 AM, Thomas Nyberg wrote: On 03/01/2018 12:46 PM, bartc wrote: If they're only called once, then it probably doesn't matter too much in terms of harming performance. Oh yeah there's no way this has any affect on performance. A smart compiler might even be able optimize the call aw

Re: csv module and NULL data byte

2018-03-01 Thread Neil Cerutti
On 2018-03-01, Tim Chase wrote: > On 2018-02-28 21:38, Dennis Lee Bieber wrote: >> >     with open( fname, 'rt', encoding='iso-8859-1' ) as csvfile: >> >> Pardon? Has the CSV module changed in the last year or so? >> >> Last time I read the documentation, it was recommended that >> t

Re: help me ? (Posting On Python-List Prohibited)

2018-03-01 Thread Rustom Mody
On Thursday, March 1, 2018 at 5:37:28 AM UTC+5:30, Steven D'Aprano wrote: > On Wed, 28 Feb 2018 09:58:24 -0800, Aktive wrote: > > > what the hell do you care about cheating.. > > > > the world doest care about cheating. > > > > its about skill. > > Because cheaters don't have skill. That's why

Strange problem with pip2

2018-03-01 Thread Cecil Westerhof
There are three pip2 packages that should be updated: apsw (3.13.0.post1) - Latest: 3.9.2.post1 [sdist] mysql-utilities (1.6.4) - Latest: 1.4.3 [sdist] pygobject (3.22.0) - Latest: 3.27.4 [sdist] But the strange thing is that the installed version is newer as the new version. And when

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Steven D'Aprano
On Wed, 28 Feb 2018 18:51:33 -0800, Rick Johnson wrote: >> What happens if the __del__ method recreates a reference to the object? > > So make instantation of the object in its __del__ method an illegal op! Why should it be illegal? And could that even be enforced in Python? Is this one of thos

Problem: Need galileo running on debian wheezy

2018-03-01 Thread Gene Heskett
I know its supposed to be in the debian stretch repo's. I've been told to get a fitbit, but they don't support linux of any flavor, and that leaves galileo as the possible solution? So how should I proceed since the only stretch machine I have ATM is an arm64, aka a rock64. -- Cheers, Gene H

Re: Detection of ultrasonic side channels in mobile devices with Python?

2018-03-01 Thread Chris Angelico
On Thu, Mar 1, 2018 at 10:51 AM, Steven D'Aprano wrote: > On Thu, 01 Mar 2018 08:54:52 +1100, Chris Angelico wrote: > >> But this part sounds like prime quality tinfoil hat material: >> >>> Tell me how exactly ultrasonic side channels may activate remotely >>> specific neural pathways implicated i

Re: Is there are good DRY fix for this painful design pattern?

2018-03-01 Thread Jugurtha Hadjar
On 03/01/2018 10:34 AM, Gregory Ewing wrote: After this thread, the term "docstring" is never going to mean quite the same thing to me again. I still feel that the following is quite readable: <---> import inspect def snatch(func):     def snatched(self, *arg

Re: Functions unnecessarily called in Python/pylifecycle.c:_Py_InitializeCore() ?

2018-03-01 Thread Thomas Nyberg
On 03/01/2018 12:46 PM, bartc wrote: > If they're only called once, then it probably doesn't matter too much in > terms of harming performance. Oh yeah there's no way this has any affect on performance. A smart compiler might even be able optimize the call away entirely. Even if it couldn't, it's

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-01 Thread Richard Damon
On 2/28/18 11:00 PM, ROGER GRAYDON CHRISTMAN wrote: On Wed, Feb 28, 2018, Rick Johnson wrote: > On Wednesday, February 28, 2018 at 5:02:17 PM UTC-6, Chris Angelico wrote: Here's one example: reference cycles. When do they get detected? Taking a really simple situation: class Foo: def __ini

Re: Functions unnecessarily called in Python/pylifecycle.c:_Py_InitializeCore() ?

2018-03-01 Thread bartc
On 01/03/2018 09:57, Thomas Nyberg wrote: Hello, I was playing around with cpython and noticed the following. The `_PyFrame_Init()` and `PyByteArray_Init()` functions are called in these two locations: https://github.com/python/cpython/blob/master/Python/pylifecycle.c#L693-L694

Re: In Python2, does it need to wrap imp.find/load_module with imp_acquire/release_lock?

2018-03-01 Thread Xiang Zhang
On Wednesday, February 28, 2018 at 3:02:38 PM UTC+8, dieter wrote: > Xiang Zhang writes: > > > Just like the title. It seems to me it is needed from the source code but > > codes in stdlib all doesn't do that. > > The "import" machinery uses locks of its own (to protect "sys.modules"). > > I a

Functions unnecessarily called in Python/pylifecycle.c:_Py_InitializeCore() ?

2018-03-01 Thread Thomas Nyberg
Hello, I was playing around with cpython and noticed the following. The `_PyFrame_Init()` and `PyByteArray_Init()` functions are called in these two locations: https://github.com/python/cpython/blob/master/Python/pylifecycle.c#L693-L694 https://github.com/python/cpython/blob/mas

Re: Is there are good DRY fix for this painful design pattern?

2018-03-01 Thread Gregory Ewing
After this thread, the term "docstring" is never going to mean quite the same thing to me again. -- Greg -- https://mail.python.org/mailman/listinfo/python-list