Comments wanted: Proposed change to install layout

2012-03-17 Thread VanL
There is a proposal on Python-dev right now (championed by me) to harmonize the install layout for Python between platforms. This change would be most noticeable on Windows. Specifically, using Python 3.3 or above: 1) the 'Scripts' directory would change to 'bin'; 2) python.exe would move to th

Re: Daemonization / Popen / pipe issue

2012-03-17 Thread Cameron Simpson
On 18Mar2012 12:35, John O'Hagan wrote: | On Sat, 17 Mar 2012 18:17:10 -0400 | Lee Clemens wrote: | > Is it generally not recommended to daemonize Python applications using | > this method? | | I'm no guru, but not that I know of. I haven't seen the os.fork method you use | before; out of inter

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Evan Driscoll
On 3/17/2012 9:03, Antti J Ylikoski wrote: > > In his legendary book series The Art of Computer Programming, > Professor Donald E. Knuth presents many of his algorithms in the form > that they have been divided in several individual phases, with > instructions to GOTO to another phase interspersed

Re: Python is readable

2012-03-17 Thread Chris Angelico
On Sun, Mar 18, 2012 at 1:05 PM, Steven D'Aprano wrote: > I'm not sure if you're making a point there, or just a witty observation, > but for the record I would accept dictionaries adding "todo" as a jargon > entry. I don't think it is widespread enough to count as a regular word, > but if we can

Re: Python is readable

2012-03-17 Thread Steven D'Aprano
On Sun, 18 Mar 2012 12:07:36 +1100, Chris Angelico wrote: > On Sun, Mar 18, 2012 at 11:57 AM, Steven D'Aprano > wrote: >> The vast majority of English speakers write things like: >> >>    TO DO: > > And the vast majority of programmers leave out the space, even in > non-code. I'm not sure if yo

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Steven D'Aprano
On Sat, 17 Mar 2012 17:28:38 -0600, Michael Torrie wrote: > Thank you. Your example makes more clear your assertion about "labels" > and how really A1 and A5 were the only real labels in the example. > Though I still do not really see why "states" is not a good equivalence > for labels in this ca

Re: Using non-dict namespaces in functions

2012-03-17 Thread Steven D'Aprano
On Sat, 17 Mar 2012 11:42:49 -0700, Eric Snow wrote: > On Sat, Mar 17, 2012 at 4:18 AM, Steven D'Aprano > wrote: >> Note that it is important for my purposes that MockChainMap does not >> inherit from dict. > > Care to elaborate? I want to use collections.ChainMap, or something very like it, an

Re: Python is readable

2012-03-17 Thread Steven D'Aprano
On Sat, 17 Mar 2012 21:23:45 +0100, Kiuhnm wrote: > On 3/16/2012 14:03, Steven D'Aprano wrote: >> A one line routine is still a routine. There is nothing ungrammatical >> about "If you can: take the bus.", although it is non-idiomatic >> English. > > In another post you wrote > "Sorry, I was talk

Re: Python is readable

2012-03-17 Thread Steven D'Aprano
On Sat, 17 Mar 2012 20:59:34 +0100, Kiuhnm wrote: > Ok, so length and readability are orthogonal properties. Could you > please explain to me in which way > mov eax, 3 > should be less readable than > for i in x: print(i) > ? "mov eax, 3" requires more domain-specific knowledge. It oper

Re: Daemonization / Popen / pipe issue

2012-03-17 Thread John O'Hagan
On Sat, 17 Mar 2012 18:17:10 -0400 Lee Clemens wrote: > On 03/16/2012 11:37 PM, John O'Hagan wrote: > > On Fri, 16 Mar 2012 22:12:14 -0400 > > Lee Clemens wrote: > > > >> I have a multi-threaded application > >> > >> I have provided a test-case here: https://gist.github.com/2054194 > > I haven't

Re: Python is readable

2012-03-17 Thread Chris Angelico
On Sun, Mar 18, 2012 at 11:57 AM, Steven D'Aprano wrote: > The vast majority of English speakers write things like: > >    TO DO: And the vast majority of programmers leave out the space, even in non-code. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-17 Thread Steven D'Aprano
On Sat, 17 Mar 2012 21:54:40 +0100, Kiuhnm wrote: > On 3/16/2012 21:04, Prasad, Ramit wrote: >>> People spell your name Stephen, sometimes too. Thinking of changing >>> it? Gore Vidal's quote has panache, a valid compensation for breaking >> the usual rule. How many other uses on that page are sim

Re: Python is readable

2012-03-17 Thread Ben Finney
Kiuhnm writes: > Welcome in the realm of trolling. Thank you for stating clearly what you're doing. Welcome to yet another kill-file. *plonk* -- \ “I am too firm in my consciousness of the marvelous to be ever | `\ fascinated by the mere supernatural …” —Joseph Conrad, _The | _o

Re: Does anyone actually use PyPy in production?

2012-03-17 Thread Dan Stromberg
I personally feel that python-list should be restricted to discussing Python the language, not just CPython the implementation. Anyway, there are many kinds of production, no? But I use Pypy for my backups frequently, which is a form of production use. Pypy+backshift pass my automated tests as w

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Michael Torrie
On 03/17/2012 11:55 AM, Kiuhnm wrote: > Why should I write a treatise on decompilation techniques on this ng? You were the one that said simply, you're doing it wrong followed by a terse statement, do it like a decompiler. I am familiar with how one might implement a decompiler, as well as a comp

Re: Python is readable

2012-03-17 Thread Michael Torrie
On 03/17/2012 03:28 PM, Kiuhnm wrote: >> They are equally readable. The first one sets EAX to 3; the second >> displays all elements of x on the console. Assembly is readable on a >> very low level, but it's by nature verbose at a high level, and thus >> less readable (you can't eyeball a function

Re: Daemonization / Popen / pipe issue

2012-03-17 Thread Lee Clemens
On 03/16/2012 11:37 PM, John O'Hagan wrote: > On Fri, 16 Mar 2012 22:12:14 -0400 > Lee Clemens wrote: > >> I have a multi-threaded application >> >> I have provided a test-case here: https://gist.github.com/2054194 > I haven't looked at your test case yet, but a possible cause is the fact that > t

Re: Python is readable

2012-03-17 Thread Kiuhnm
On 3/17/2012 22:20, Chris Angelico wrote: On Sun, Mar 18, 2012 at 6:59 AM, Kiuhnm wrote: Could you please explain to me in which way mov eax, 3 should be less readable than for i in x: print(i) ? They are equally readable. The first one sets EAX to 3; the second displays all elements

Re: Python is readable

2012-03-17 Thread Kiuhnm
On 3/17/2012 0:39, Michael Torrie wrote: For someone who claims he's merely examining the language and seeking to learn about it, Kiuhnm is jumping awfully quickly into the realm of trolling. I'm speechless... thanks, man! Kiuhnm -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-17 Thread Chris Angelico
On Sun, Mar 18, 2012 at 6:59 AM, Kiuhnm wrote: > Could you please explain to me in which way >    mov eax, 3 > should be less readable than >    for i in x: print(i) > ? They are equally readable. The first one sets EAX to 3; the second displays all elements of x on the console. Assembly is reada

Re: Python is readable

2012-03-17 Thread Kiuhnm
On 3/16/2012 21:04, Prasad, Ramit wrote: People spell your name Stephen, sometimes too. Thinking of changing it? Gore Vidal's quote has panache, a valid compensation for breaking the usual rule. How many other uses on that page are similar? He provided common examples and reference links. Seem

Re: Python is readable

2012-03-17 Thread Kiuhnm
On 3/16/2012 14:03, Steven D'Aprano wrote: A one line routine is still a routine. There is nothing ungrammatical about "If you can: take the bus.", although it is non-idiomatic English. In another post you wrote "Sorry, I was talking about the other sort, the ones who apply the grammatical rule

Re: Python is readable

2012-03-17 Thread Kiuhnm
On 3/16/2012 17:48, Steven D'Aprano wrote: On Fri, 16 Mar 2012 13:10:12 +0100, Kiuhnm wrote: Maybe we should define *exactly* what readability is (in less then 500 lines, if possible). If you can't be bothered to read my post before replying, save yourself some more time and don't bother to r

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread John Nagle
On 3/17/2012 9:31 AM, Antti J Ylikoski wrote: On 17.3.2012 17:47, Roy Smith wrote: In article, Antti J Ylikoski wrote: I came across the problem, which would be the clearest way to program such algorithms with a programming language such as Python, which has no GOTO statement. Oh, my, I can't

Re: Using non-dict namespaces in functions

2012-03-17 Thread Eric Snow
On Sat, Mar 17, 2012 at 4:18 AM, Steven D'Aprano wrote: > Note that it is important for my purposes that MockChainMap does not > inherit from dict. Care to elaborate? > Now I try to create a function that uses a MockChainMap instead of a dict > for its globals: > > function = type(lambda: None)

Re: urllib.urlretrieve never returns???

2012-03-17 Thread Christian Heimes
Am 17.03.2012 15:13, schrieb Laszlo Nagy: > See attached example code. I have a program that calls exactly the same > code, and here is the strange thing about it: > > * Program is started as "start.py", e.g. with an open console. In this > case, the program works! > * Program is started a

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Kiuhnm
On 3/17/2012 16:53, Michael Torrie wrote: > On 03/17/2012 09:12 AM, Kiuhnm wrote: >> On 3/17/2012 16:01, Michael Torrie wrote: >>> On 03/17/2012 08:45 AM, Kiuhnm wrote: Your way is easy, but the result is poor. >>> >>> In what way? >> >> The resulting code is inefficient, difficult to comprehe

Re: urllib.urlretrieve never returns???

2012-03-17 Thread Chris Angelico
On Sun, Mar 18, 2012 at 4:31 AM, Laszlo Nagy wrote: > You are right, I should have added "import traceback". However, I tried > this: > >        except: >            self.Log("Exception") > > and still nothing was logged. Another proof is that the number of threads is > increased every time I pres

Re: urllib.urlretrieve never returns???

2012-03-17 Thread Laszlo Nagy
2012.03.17. 17:34 keltezéssel, Chris Angelico wrote 2012/3/18 Laszlo Nagy: In the later case, "log.txt" only contains "#1" and nothing else. If I look at pythonw.exe from task manager, then its shows +1 thread every time I click the button, and "#1" is appended to the file. try:

elasticsearch client

2012-03-17 Thread Miki Tebeka
Greetings, I see several elasticsearch clients on PyPI, any recommendations? Thanks, -- Miki -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Antti J Ylikoski
On 17.3.2012 17:47, Roy Smith wrote: In article, Antti J Ylikoski wrote: I came across the problem, which would be the clearest way to program such algorithms with a programming language such as Python, which has no GOTO statement. It struck me that the above construction actually is a modi

Re: urllib.urlretrieve never returns???

2012-03-17 Thread Chris Angelico
2012/3/18 Laszlo Nagy : > In the later case, "log.txt" only contains "#1" and nothing else. If I look > at pythonw.exe from task manager, then its shows +1 thread every time I > click the button, and "#1" is appended to the file. try: fpath = urllib.urlretrieve(imgurl)[0]

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Michael Torrie
On 03/17/2012 09:12 AM, Kiuhnm wrote: > On 3/17/2012 16:01, Michael Torrie wrote: >> On 03/17/2012 08:45 AM, Kiuhnm wrote: >>> Your way is easy, but the result is poor. >> >> In what way? > > The resulting code is inefficient, difficult to comprehend and to mantain. > >> What is your recommended

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Roy Smith
In article , Antti J Ylikoski wrote: > I came across the problem, which would be the clearest way to program > such algorithms with a programming language such as Python, which has > no GOTO statement. It struck me that the above construction actually > is a modified Deterministic Finite Automa

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Kiuhnm
On 3/17/2012 16:01, Michael Torrie wrote: On 03/17/2012 08:45 AM, Kiuhnm wrote: Your way is easy, but the result is poor. In what way? The resulting code is inefficient, difficult to comprehend and to mantain. What is your recommended way? One should rewrite the code. There is a reason w

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Michael Torrie
On 03/17/2012 08:45 AM, Kiuhnm wrote: > Your way is easy, but the result is poor. In what way? What is your recommended way? > Your should try to rewrite it. > Decompilers do exactly that. Decompilers rewrite code for people? That's really neat. -- http://mail.python.org/mailman/listinfo/pyt

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Kiuhnm
On 3/17/2012 15:03, Antti J Ylikoski wrote: In his legendary book series The Art of Computer Programming, Professor Donald E. Knuth presents many of his algorithms in the form that they have been divided in several individual phases, with instructions to GOTO to another phase interspersed in the

urllib.urlretrieve never returns???

2012-03-17 Thread Laszlo Nagy
See attached example code. I have a program that calls exactly the same code, and here is the strange thing about it: * Program is started as "start.py", e.g. with an open console. In this case, the program works! * Program is started as "start.pyw", e.g. with no open console under Windo

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Mel Wilson
Antti J Ylikoski wrote: > > In his legendary book series The Art of Computer Programming, > Professor Donald E. Knuth presents many of his algorithms in the form > that they have been divided in several individual phases, with > instructions to GOTO to another phase interspersed in the text of th

Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Antti J Ylikoski
In his legendary book series The Art of Computer Programming, Professor Donald E. Knuth presents many of his algorithms in the form that they have been divided in several individual phases, with instructions to GOTO to another phase interspersed in the text of the individual phases. I. e. they

Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-17 Thread Cosmia Luna
On Saturday, March 17, 2012 6:04:58 PM UTC+8, Cosmia Luna wrote: > On Saturday, March 17, 2012 5:25:06 PM UTC+8, Peter Otten wrote: > > Cosmia Luna wrote: > > > > > I'm porting my existing work to Python 3.X, but... > > > > > > class Foo: > > > def bar(self): > > > pass > > > > > > m

Using non-dict namespaces in functions

2012-03-17 Thread Steven D'Aprano
Inspired by the new collections.ChainMap in Python 3.3 http://docs.python.org/dev/library/collections.html#collections.ChainMap I would like to experiment with similar non-dictionary namespaces in Python 3.2. My starting point is these two recipes, adapted for Python 3.2: http://code.activesta

Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-17 Thread Cosmia Luna
On Saturday, March 17, 2012 5:25:06 PM UTC+8, Peter Otten wrote: > Cosmia Luna wrote: > > > I'm porting my existing work to Python 3.X, but... > > > > class Foo: > > def bar(self): > > pass > > > > mthd = Foo.bar > > > > assert mthd.im_class is Foo # this does not work in py3k > >

Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-17 Thread Steven D'Aprano
On Fri, 16 Mar 2012 22:30:34 -0700, Cosmia Luna wrote: > I'm porting my existing work to Python 3.X, but... > > class Foo: > def bar(self): > pass > > mthd = Foo.bar > > assert mthd.im_class is Foo # this does not work in py3k > > So, how can I get a reference to Foo? This is impor

Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-17 Thread Peter Otten
Cosmia Luna wrote: > I'm porting my existing work to Python 3.X, but... > > class Foo: > def bar(self): > pass > > mthd = Foo.bar > > assert mthd.im_class is Foo # this does not work in py3k > > So, how can I get a reference to Foo? This is important when writing > decorators, the

Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-17 Thread Cosmia Luna
On Saturday, March 17, 2012 3:34:57 PM UTC+8, Richard Thomas wrote: > On Saturday, 17 March 2012 05:30:34 UTC, Cosmia Luna wrote: > > I'm porting my existing work to Python 3.X, but... > > > > class Foo: > > def bar(self): > > pass > > > > mthd = Foo.bar > > > > assert mthd.im_class

Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-17 Thread Richard Thomas
On Saturday, 17 March 2012 05:30:34 UTC, Cosmia Luna wrote: > I'm porting my existing work to Python 3.X, but... > > class Foo: > def bar(self): > pass > > mthd = Foo.bar > > assert mthd.im_class is Foo # this does not work in py3k mthd.im_class is the class of mthd.im_self not the