Re: Is `wsample` a proper name for a function like this?

2012-10-10 Thread suzaku
On Thursday, October 11, 2012 2:29:37 PM UTC+8, Steven D'Aprano wrote: > On Wed, 10 Oct 2012 20:33:16 -0700, Satoru Logic wrote: > > > > > I came across a function named `wsample` in a `utils` package of my > > > workplace recently. > > > > > > The "w" in `wsample` stands for `weighted`, and

Re: Is `wsample` a proper name for a function like this?

2012-10-10 Thread Steven D'Aprano
On Wed, 10 Oct 2012 20:33:16 -0700, Satoru Logic wrote: > I came across a function named `wsample` in a `utils` package of my > workplace recently. > > The "w" in `wsample` stands for `weighted`, and it randomly selects an > element from a container according to relative weights of all the > elem

Re: Private methods

2012-10-10 Thread Dieter Maurer
alex23 writes: > On 10 Oct, 17:03, real-not-anti-spam-addr...@apple-juice.co.uk (D.M. > Procida) wrote: >> It certainly makes it quick to build a class with the attributes I need, >> but it does make tracing logic sometimes a pain in the neck. >> >> I don't know what the alternative is though. >

Re: Is `wsample` a proper name for a function like this?

2012-10-10 Thread alex23
On Oct 11, 1:33 pm, Satoru Logic wrote: > I came across a function named `wsample` in a `utils` package > of my workplace recently. > > The "w" in `wsample` stands for `weighted`, and it randomly > selects an element from a container according to relative > weights of all the elements. > > So when

Re: Is `wsample` a proper name for a function like this?

2012-10-10 Thread Terry Reedy
On 10/10/2012 11:33 PM, Satoru Logic wrote: I came across a function named `wsample` in a `utils` package of my workplace recently. The "w" in `wsample` stands for `weighted`, and it randomly selects an element from a container according to relative weights of all the elements. I agree that wt

Is `wsample` a proper name for a function like this?

2012-10-10 Thread Satoru Logic
I came across a function named `wsample` in a `utils` package of my workplace recently. The "w" in `wsample` stands for `weighted`, and it randomly selects an element from a container according to relative weights of all the elements. In most articles and codes I saw online, a function like thi

Re: Generating C++ code

2012-10-10 Thread Tim Roberts
Jean-Michel Pichavant wrote: > >I'm trying to generate C++ code from an XML file. I'd like to use a template >engine, which imo produce something readable and maintainable. >My google search about this subject has been quite unsuccessful, I've been >redirected to template engine specific to html

Re: Private methods

2012-10-10 Thread 88888 Dihedral
D.M. Procida於 2012年10月9日星期二UTC+8下午9時24分30秒寫道: > What exactly is the point of a private method? Why or when would I want > Private methods in the object level are searched first in the run time of python interpreter. I did turn some private methods in to c programs from time to time. --

Re: Private methods

2012-10-10 Thread Steven D'Aprano
On Wed, 10 Oct 2012 18:34:01 -0700, alex23 wrote: > On 10 Oct, 17:03, real-not-anti-spam-addr...@apple-juice.co.uk (D.M. > Procida) wrote: >> It certainly makes it quick to build a class with the attributes I >> need, but it does make tracing logic sometimes a pain in the neck. >> >> I don't know

Re: Private methods

2012-10-10 Thread alex23
On 11 Oct, 02:14, Mark Lawrence wrote: > What language? I think he's objecting to "bitch". I had to block him on G+ because he kept asking me to self-censor posts that he had _chosen to read_. -- http://mail.python.org/mailman/listinfo/python-list

Re: Private methods

2012-10-10 Thread alex23
On 10 Oct, 17:03, real-not-anti-spam-addr...@apple-juice.co.uk (D.M. Procida) wrote: > It certainly makes it quick to build a class with the attributes I need, > but it does make tracing logic sometimes a pain in the neck. > > I don't know what the alternative is though. Components. The examples

Hello, We are looking for a qualified Sr. Python Developer for a job position in Bethesda, MD.

2012-10-10 Thread John Cook
Please let me know, if you might want to consider this progressive job opportunity and discuss the position details. Thank you for the thoughts. Regards, John Cook Team Recruiting Services Terra Health, Inc 5710 W. Hausman, Ste 108 San Antonio, TX 78249 P-210.424.4017 F-210.582.0084 C-210.823

Re: communicate with external process via pty

2012-10-10 Thread Tim
On Wednesday, October 10, 2012 2:58:55 AM UTC-4, Peter Otten wrote: > Tim Arnold wrote: > > > import os,sys > > import subprocess > > import shlex > > import pty > > cmd = 'tralics --interactivemath' > > (master, slave) = pty.openpty() > > p = subprocess.Popen(shlex.split(cmd),close_fds=True, >

Re: an error in python lib?

2012-10-10 Thread Ian Kelly
On Wed, Oct 10, 2012 at 6:18 AM, Ulrich Eckhardt wrote: >> The .acquire method will return True if the attempt to acquire has been >> successful. This can occur only if it is not currently owned. > > > The comment clearly states "owned by current thread", not "owned by any > thread". The latter wo

Re: Private methods

2012-10-10 Thread Grant Edwards
On 2012-10-10, Mark Lawrence wrote: > On 10/10/2012 16:56, Ramchandra Apte wrote: >> On Wednesday, 10 October 2012 18:38:04 UTC+5:30, Roy Smith wrote: >>> Public: I hereby declare that this method or attribute is part of the >>> promised never to change interface of this class. I might possibly

Re: Private methods

2012-10-10 Thread Mark Lawrence
On 10/10/2012 16:56, Ramchandra Apte wrote: On Wednesday, 10 October 2012 18:38:04 UTC+5:30, Roy Smith wrote: Public: I hereby declare that this method or attribute is part of the promised never to change interface of this class. I might possibly break that promise at some point in the future,

Re: Private methods

2012-10-10 Thread Ramchandra Apte
On Wednesday, 10 October 2012 18:38:04 UTC+5:30, Roy Smith wrote: > In article > > <1krpdak.u0qy9e1a4knspn%real-not-anti-spam-addr...@apple-juice.co.uk>, > > real-not-anti-spam-addr...@apple-juice.co.uk (D.M. Procida) wrote: > > > > > Mark Lawrence wrote: > > > > > > > On 09/10/2012 14:

Re: Generating C++ code

2012-10-10 Thread Stefan Behnel
Jean-Michel Pichavant, 10.10.2012 17:05: >> SoC == System On a Chip. >> >> It's a single-chip micro-controller embedded inside something that's >> not a general purpose computer (e.g. it's in a router, or piece of >> industrial equipment, or whatever). It may only have a couple MB of >> memory, it

Re: Generating C++ code

2012-10-10 Thread Jean-Michel Pichavant
- Original Message - > On 2012-10-10, Etienne Robillard wrote: > > On Wed, 10 Oct 2012 11:59:50 +0200 (CEST) > > Jean-Michel Pichavant wrote: > > > >> Well, the C++ code will end up running on a MIPS on a SOC, > >> unfortunately, python is not an option here. The xml to C++ makes > >> a

Re: Generating C++ code

2012-10-10 Thread Grant Edwards
On 2012-10-10, Etienne Robillard wrote: > On Wed, 10 Oct 2012 11:59:50 +0200 (CEST) > Jean-Michel Pichavant wrote: > >> Well, the C++ code will end up running on a MIPS on a SOC, >> unfortunately, python is not an option here. The xml to C++ makes a >> lot of sense, because only a small part of

Re: Generating C++ code

2012-10-10 Thread Michael Torrie
On 10/09/2012 10:00 AM, Jean-Michel Pichavant wrote: > Greetings, > > I'm trying to generate C++ code from an XML file. I'd like to use a template > engine, which imo produce something readable and maintainable. > My google search about this subject has been quite unsuccessful, I've been > redir

Python Web Routing Benchmark

2012-10-10 Thread Andriy Kornatskyy
How fast web frameworks process routing (URL dispatch)?   Here is a benchmark for various web frameworks (bottle, django, flask, pyramid, tornado and wheezy.web) running the following routing: static, dynamic, SEO and missing... with a trivial 'hello world' application (all routes are pointing t

Re: Delete duplicate rows in textfile - except it contains a "{" or "}"

2012-10-10 Thread Joon Ki Choi
lines_seen = set() # holds lines already seen outfile = open("literatur_clean.txt", "w") for line in open("literatur_dupl.txt", "r"): if ('{' in line or '}' in line) or line not in lines_seen: outfile.write(line) lines_seen.add(line) outfile.close() -- http://mail.python.org/ma

Re: Delete duplicate rows in textfile - except it contains a "{" or "}"

2012-10-10 Thread Dave Angel
On 10/10/2012 04:51 AM, Joon Ki Choi wrote: > Hello Pythonistas, > > i have a very large textfile with contents like: > > @INBOOK{Ackermann1999-b, > author = {Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and > Ackermann, > K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and A

Re: an error in python lib?

2012-10-10 Thread Ulrich Eckhardt
Am 10.10.2012 03:16, schrieb MRAB: On 2012-10-10 01:32, Wenhua Zhao wrote: Hi list, I just noticed that in /usr/lib/python2.7/threading.py class _Condition(_Verbose): ... def _is_owned(self): # Return True if lock is owned by current_thread. # This method is called

Re: Private methods

2012-10-10 Thread Roy Smith
In article <1krpdak.u0qy9e1a4knspn%real-not-anti-spam-addr...@apple-juice.co.uk>, real-not-anti-spam-addr...@apple-juice.co.uk (D.M. Procida) wrote: > Mark Lawrence wrote: > > > On 09/10/2012 14:24, D.M. Procida wrote: > > > What exactly is the point of a private method? Why or when would I wa

Re: Private methods

2012-10-10 Thread Robert Kern
On 10/10/12 12:51 AM, Steven D'Aprano wrote: On Tue, 09 Oct 2012 11:08:13 -0600, Ian Kelly wrote: On Tue, Oct 9, 2012 at 8:08 AM, Demian Brecht wrote: A single underscore semantically means private. A double underscore will name mangle the function such that it's only accessible strictly by n

Re: Generating C++ code

2012-10-10 Thread Jean-Michel Pichavant
> sorry but i don't get what you mean with a "MIPS on a SOC". Is not > Python well supported on MIPS ? Sorry, SOC means system on chip. The binary runs on the MIPS, there's no file system, no operanding system, except for one very basic task scheduler. That's why everything is done at compile t

Re: pydelicious documentation

2012-10-10 Thread Alec Taylor
No worries, happy to help :) On Tue, Oct 9, 2012 at 11:44 PM, Andres Soto wrote: > This one I didn't know > Thanks you! > Prof. Dr. Andrés Soto > > > > From: Alec Taylor > To: Andres Soto > Cc: "python-list@python.org" > Sent: Tuesday, October 9, 2012 1:52 PM >

Re: an error in python lib?

2012-10-10 Thread Ulrich Eckhardt
Am 10.10.2012 02:32, schrieb Wenhua Zhao: I just noticed that in /usr/lib/python2.7/threading.py class _Condition(_Verbose): ... def _is_owned(self): # Return True if lock is owned by current_thread. # This method is called only if __lock doesn't have # _is_o

Re: Generating C++ code

2012-10-10 Thread Ulrich Eckhardt
Am 09.10.2012 18:00, schrieb Jean-Michel Pichavant: I'm trying to generate C++ code from an XML file. I'd like to use a template engine, which imo produce something readable and maintainable. [...] Here's my flow: XML file -> nice python app -> C++ code There is one question that you should an

Re: Generating C++ code

2012-10-10 Thread andrea crotti
2012/10/10 Jean-Michel Pichavant : > Well, the C++ code will end up running on a MIPS on a SOC, unfortunately, > python is not an option here. > The xml to C++ makes a lot of sense, because only a small part of the code is > generated that way (everything related to log & fatal events). Everythin

Re: Generating C++ code

2012-10-10 Thread Stefan Behnel
Jean-Michel Pichavant, 10.10.2012 11:59: > Well, the C++ code will end up running on a MIPS on a SOC, > unfortunately, python is not an option here. The xml to C++ makes a lot > of sense, because only a small part of the code is generated that way > (everything related to log & fatal events). Every

Re: Generating C++ code

2012-10-10 Thread Etienne Robillard
On Wed, 10 Oct 2012 11:59:50 +0200 (CEST) Jean-Michel Pichavant wrote: > Well, the C++ code will end up running on a MIPS on a SOC, unfortunately, > python is not an option here. > The xml to C++ makes a lot of sense, because only a small part of the code is > generated that way (everything re

Re: Delete duplicate rows in textfile - except it contains a "{" or "}"

2012-10-10 Thread Peter Otten
Joon Ki Choi wrote: > > Hello Pythonistas, > > i have a very large textfile with contents like: > > @INBOOK{Ackermann1999-b, > author = {Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and > Ackermann, > K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. > and A

Re: Generating C++ code

2012-10-10 Thread Jean-Michel Pichavant
- Original Message - > On Tue, 09 Oct 2012 20:55:48 +0100 > Andrea Crotti wrote: > > > On 10/09/2012 05:00 PM, Jean-Michel Pichavant wrote: > > > Greetings, > > > > > > I'm trying to generate C++ code from an XML file. I'd like to use > > > a template engine, which imo produce something r

Re: Delete duplicate rows in textfile - except it contains a "{" or "}"

2012-10-10 Thread Mark Lawrence
On 10/10/2012 09:51, Joon Ki Choi wrote: Hello Pythonistas, i have a very large textfile with contents like: @INBOOK{Ackermann1999-b, author = {Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K

Delete duplicate rows in textfile - except it contains a "{" or "}"

2012-10-10 Thread Joon Ki Choi
Hello Pythonistas, i have a very large textfile with contents like: @INBOOK{Ackermann1999-b, author = {Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackerm

Re: lxml 3.0 final released - efficient XML and HTML processing with Python

2012-10-10 Thread D.M. Procida
Stefan Behnel wrote: > it's been a while since the last stable release series appeared, so I'm > proud to announce the final release of lxml 3.0. Great. We use it in . Thanks. Daniele -- http://mail.python.org/mailman/listinfo/python

Re: Private methods

2012-10-10 Thread D.M. Procida
Demian Brecht wrote: > On 12-10-09 04:51 PM, Steven D'Aprano wrote: > > Really? I tend to view name mangling as a waste of time, and complex > > inheritance structures as something to avoid. > > Yep, I've been coming around to this as of late. I have a lot of inheritance. I don't know whether y

Re: communicate with external process via pty

2012-10-10 Thread Peter Otten
Tim Arnold wrote: > I have an external process, 'tralics' that emits mathml when you feed it > latex equations. I want to get that mathml into a string. > > The problem for me is that tralics wants to talk to a tty and I've never > done that before; it basically starts its own subshell. > > I ha