Re: Write this accumuator in a functional style

2017-07-13 Thread Paul Rubin
Chris Angelico writes: > some point it'll need to be rebalanced, which could at worst case > be O(n). No, you use a structure like an AVL tree or red-black tree, so it's within a constant factor of balanced after each insertion. You rewrite O(log n) of the nodes, and juggle around a constant nu

Re: Write this accumuator in a functional style

2017-07-13 Thread Chris Angelico
On Thu, Jul 13, 2017 at 6:15 PM, Paul Rubin wrote: > Chris Angelico writes: >> some point it'll need to be rebalanced, which could at worst case >> be O(n). > > No, you use a structure like an AVL tree or red-black tree, so it's > within a constant factor of balanced after each insertion. You re

Re: Write this accumuator in a functional style

2017-07-13 Thread Paul Rubin
Chris Angelico writes: > Maybe I'm completely on the wrong track here, but the last time I > implemented a self-balancing tree, it usually involved a fair amount > of mutation. AVL trees are fairly simple to implement without mutation. Red-black trees are traditionally implemented with mutation,

Re: Write this accumuator in a functional style

2017-07-13 Thread Marko Rauhamaa
Paul Rubin : > Chris Angelico writes: >> Maybe I'm completely on the wrong track here, but the last time I >> implemented a self-balancing tree, it usually involved a fair amount >> of mutation. > > AVL trees are fairly simple to implement without mutation. Red-black > trees are traditionally im

Re: Write this accumuator in a functional style

2017-07-13 Thread Rustom Mody
Marko wrote: > Simple, yes, but is the worst case > insertion/deletion time still within > O(log n)? Good point; and needs to be applied to Steven's append-using OP as well Yeah I know append method is supposedly O(1). I find that surprising... More so when the article https://wiki.python.or

Re: Write this accumuator in a functional style

2017-07-13 Thread Steve D'Aprano
On Thu, 13 Jul 2017 10:10 pm, Rustom Mody wrote: > Yeah I know append method is supposedly O(1). > I find that surprising... > More so when the article > https://wiki.python.org/moin/TimeComplexity > talks of average case Vs amortized-worst case(!) Whatever does that mean? "Average case" refers

Re: python 3.5 raiaing an error when import the class Manager in this module sayning name Manager is not define

2017-07-13 Thread Rhodri James
On 12/07/17 16:19, WoFy The 95s wrote: On Wednesday, 12 July 2017 18:57:11 UTC+5:30, Peter Otten wrote: WoFy The 95s wrote: i tried from idle interpreter from person import Manager from person import Manager Traceback (most recent call last): File "", line 1, in from person import Mana

Re: Write this accumuator in a functional style

2017-07-13 Thread Pavol Lisy
On 7/13/17, Steve D'Aprano wrote: > [1] Actually, CPython's lists initially quadruple the size of the array, up > to a > certain point, and then switch to doubling. This ensures that small lists > have > even fewer expensive resizes, at the cost of wasting a bit more memory, but > its > only a sm

Re: Write this accumuator in a functional style

2017-07-13 Thread Rustom Mody
Pavol Lisy wrote: > IMHO problem is doubling size for huge lists. > Or waste big memory for huge frozensets. I mean resize it to 2*N if > its size is just N+1. Couple that with the fact that space-time are not unrelated on any modern VM based OS + cache based hw. Doubly so for "managed" langua

Process in not get killed using subprocess.call() in python thread

2017-07-13 Thread sanky8793
I have created one thread in python, and that thread is running in infinite loop, but when I was trying to kill a process by making use of subprocess.call("my ps command") Its not actually working Here is the code, import threading import subprocess def B(): while True: cmd="ps

Re: Write this accumuator in a functional style

2017-07-13 Thread Rhodri James
On 13/07/17 16:09, Rustom Mody wrote: Pavol Lisy wrote: IMHO problem is doubling size for huge lists. Or waste big memory for huge frozensets. I mean resize it to 2*N if its size is just N+1. Couple that with the fact that space-time are not unrelated on any modern VM based OS + cache base

Re: Process in not get killed using subprocess.call() in python thread

2017-07-13 Thread Rhodri James
On 13/07/17 16:42, sanky8...@gmail.com wrote: I have created one thread in python, and that thread is running in infinite loop, but when I was trying to kill a process by making use of subprocess.call("my ps command") Its not actually working Here is the code, import threading import subp

Re: Write this accumuator in a functional style

2017-07-13 Thread Steve D'Aprano
On Fri, 14 Jul 2017 01:09 am, Rustom Mody wrote: > Couple that with the fact that space-time are not unrelated on any modern VM > based OS + cache based hw. Doubly so for "managed" languages where gc buys > space for time. I don't understand that comment. Space/time have *never* been unrelated.

Re: Write this accumuator in a functional style

2017-07-13 Thread Steve D'Aprano
On Fri, 14 Jul 2017 12:59 am, Pavol Lisy wrote: > On 7/13/17, Steve D'Aprano wrote: > >> [1] Actually, CPython's lists initially quadruple the size of the array, up >> to a >> certain point, and then switch to doubling. This ensures that small lists >> have >> even fewer expensive resizes, at th

Re: Write this accumuator in a functional style

2017-07-13 Thread Pavol Lisy
On 7/13/17, Steve D'Aprano wrote: > On Fri, 14 Jul 2017 12:59 am, Pavol Lisy wrote: > >> On 7/13/17, Steve D'Aprano wrote: >> >>> [1] Actually, CPython's lists initially quadruple the size of the array, >>> up >>> to a >>> certain point, and then switch to doubling. This ensures that small lists

Re: Write this accumuator in a functional style

2017-07-13 Thread Chris Angelico
On Fri, Jul 14, 2017 at 2:26 AM, Steve D'Aprano wrote: > On Fri, 14 Jul 2017 01:09 am, Rustom Mody wrote: > >> Couple that with the fact that space-time are not unrelated on any modern VM >> based OS + cache based hw. Doubly so for "managed" languages where gc buys >> space for time. > > I don't u

Re: Write this accumuator in a functional style

2017-07-13 Thread Ned Batchelder
On Thursday, July 13, 2017 at 10:59:52 AM UTC-4, Pavol Lisy wrote: > On 7/13/17, Steve D'Aprano wrote: > > > [1] Actually, CPython's lists initially quadruple the size of the array, up > > to a > > certain point, and then switch to doubling. This ensures that small lists > > have > > even fewer e

Grapheme clusters, a.k.a.real characters

2017-07-13 Thread Steve D'Aprano
From time to time, people discover that Python's string algorithms work on code points rather than "real characters", which can lead to anomalies like the following: s = 'xäex' s = unicodedata.normalize('NFD', s) print(s) print(s[::-1]) which results in: xäex xëax If you're interested in this

Re: Grapheme clusters, a.k.a.real characters

2017-07-13 Thread Ben Finney
Steve D'Aprano writes: > From time to time, people discover that Python's string algorithms work on > code > points rather than "real characters", which can lead to anomalies like the > following: > > s = 'xäex' > s = unicodedata.normalize('NFD', s) > print(s) > print(s[::-1]) > > > which result

sydney female slut gloryhole - Free

2017-07-13 Thread jigarercivil
Very much interested... 0426465115 -- https://mail.python.org/mailman/listinfo/python-list

Re: Grapheme clusters, a.k.a.real characters

2017-07-13 Thread Marko Rauhamaa
Ben Finney : > Steve D'Aprano writes: >> From time to time, people discover that Python's string algorithms >> work on code points rather than "real characters", which can lead to >> anomalies > > [...] [unicodedata.name(c) for c in reversed(s1)] > ['LATIN SMALL LETTER X', > 'LATIN SMALL LE