Re: Avoiding defunct processes

2012-11-01 Thread Chris Angelico
On Fri, Nov 2, 2012 at 1:16 PM, Richard wrote: > Hello, > > I create child processes with subprocess.Popen(). > Then I either wait for them to finish or kill them. > Either way these processes end up as defunct until the parent process > completes: > $ ps e > 6851 pts/5Z+ 1:29 [python] >

Avoiding defunct processes

2012-11-01 Thread Richard
Hello, I create child processes with subprocess.Popen(). Then I either wait for them to finish or kill them. Either way these processes end up as defunct until the parent process completes: $ ps e 6851 pts/5Z+ 1:29 [python] This confuses another library as to whether the processes are co

Re: Negative array indicies and slice()

2012-11-01 Thread Steven D'Aprano
On Thu, 01 Nov 2012 15:25:51 -0700, Andrew Robinson wrote: > On 11/01/2012 12:07 PM, Ian Kelly wrote: >>> Pep 357 merely added cruft with index(), but really solved nothing. >>> Everything index() does could be implemented in __getitem__ and >>> usually is. >> >> No. There is a significant diff

Re: Obnoxious postings from Google Groups

2012-11-01 Thread Rhodri James
On Fri, 02 Nov 2012 01:25:37 -, Steven D'Aprano wrote: Huh. If you're messing about with ancient[1] languages like Java, C# and especially C, you're not a real programmer. Real programmers use modern, advanced languages like D, Erlang, Go or Haskell. Advanced? Huh. I have here a langu

Re: Obnoxious postings from Google Groups

2012-11-01 Thread Roy Smith
In article <50932111$0$29967$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Huh. If you're messing about with ancient[1] languages like Java, C# and > especially C, you're not a real programmer. Real programmers use modern, > advanced languages like D, Erlang, Go or Haskell. D

Re: Obnoxious postings from Google Groups

2012-11-01 Thread Steven D'Aprano
On Fri, 02 Nov 2012 10:32:08 +1100, Chris Angelico wrote: > And there are probably still a few around who maintain that Java, C#, > and even C are too modern, and that serious programmers use FORTRAN or > COBOL. Huh. If you're messing about with ancient[1] languages like Java, C# and especially

Re: Negative array indicies and slice()

2012-11-01 Thread 88888 Dihedral
andrew...@gmail.com於 2012年10月29日星期一UTC+8上午11時12分11秒寫道: > The slice operator does not give any way (I can find!) to take slices from > negative to positive indexes, although the range is not empty, nor the > expected indexes out of range that I am supplying. > > > > Many programs that I write w

Re: Negative array indicies and slice()

2012-11-01 Thread Ian Kelly
On Thu, Nov 1, 2012 at 4:25 PM, Andrew Robinson wrote: > The bottom line is: __getitem__ must always *PASS* len( seq ) to slice() > each *time* the slice() object is-used. Since this is the case, it would > have been better to have list, itself, have a default member which takes the > raw slice

Re: sort order for strings of digits

2012-11-01 Thread Steven D'Aprano
On Thu, 01 Nov 2012 11:53:06 +1100, Chris Angelico wrote: > On Thu, Nov 1, 2012 at 10:44 AM, Steven D'Aprano > wrote: >> On the contrary. If you are using cmp with sort, your sorts are slow, >> and you should upgrade to using a key function as soon as possible. >> >> > But cmp_to_key doesn't actu

Re: Obnoxious postings from Google Groups

2012-11-01 Thread Chris Angelico
On Fri, Nov 2, 2012 at 9:08 AM, wrote: > On 11/01/2012 03:55 AM, Jamie Paul Griffin wrote: >> Anybody serious about programming should be using a form of >> UNIX/Linux if you ask me. It's inconceivable that these systems >> should be avoided if you're serious about Software Engineering and >> Com

Re: lazy properties?

2012-11-01 Thread Miki Tebeka
> If you're using Python 3.2+, then functools.lru_cache probably > ... And if you're on 2.X, you can grab lru_cache from http://code.activestate.com/recipes/498245-lru-and-lfu-cache-decorators/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Private methods

2012-11-01 Thread Ian Kelly
On Tue, Oct 9, 2012 at 5:51 PM, Steven D'Aprano wrote: > On Tue, 09 Oct 2012 11:08:13 -0600, Ian Kelly wrote: > >> I tend to view name mangling as being more for avoiding internal >> attribute collisions in complex inheritance structures than for >> designating names as private. > > Really? I tend

Re: datetime issue

2012-11-01 Thread rurpy
On 11/01/2012 06:09 AM, Grant Edwards wrote:> On 2012-10-31, ru...@yahoo.com wrote: >> On 10/31/2012 09:11 AM, Grant Edwards wrote:> On 2012-09-16, ?? >> wrote: >>> Iam positng via google groups using chrome, thats all i know. >>> >>> Learn something else. Google Groups is

Re: Negative array indicies and slice()

2012-11-01 Thread Andrew Robinson
On 11/01/2012 12:07 PM, Ian Kelly wrote: On Thu, Nov 1, 2012 at 5:32 AM, Andrew Robinson wrote: H was that PEP the active state of Python, when Tim rejected the bug report? Yes. The PEP was accepted and committed in March 2006 for release in Python 2.5. The bug report is from June 2

Re: Obnoxious postings from Google Groups

2012-11-01 Thread rurpy
On 11/01/2012 03:55 AM, Jamie Paul Griffin wrote: > Anybody serious about programming should be using a form of > UNIX/Linux if you ask me. It's inconceivable that these systems > should be avoided if you're serious about Software Engineering and > Computer Science, etc. For UNIX there are loads of

Re: lazy properties?

2012-11-01 Thread Cameron Simpson
On 01Nov2012 21:38, Andrea Crotti wrote: | Seeing the wonderful "lazy val" in Scala I thought that I should try to | get the following also in Python. | The problem is that I often have this pattern in my code: | | class Sample: | def __init__(self): | self._var = None | | @p

Re: datetime issue

2012-11-01 Thread rurpy
On Wednesday, October 31, 2012 3:38:57 PM UTC-6, Mark Lawrence wrote: > On 31/10/2012 19:35, ru...@yahoo.com wrote: >> "Broken"? Yes. But so is every piece of software in one way >> or another. Thunderbird is one of the most perpetually buggy >> pierces of software I have ever used on a continui

Re: lazy properties?

2012-11-01 Thread Ian Kelly
On Thu, Nov 1, 2012 at 3:38 PM, Andrea Crotti wrote: > What I would like to write is > @lazy_property > def var_lazy(self): > return long_computation() > > and this should imply that the long_computation is called only once.. If you're using Python 3.2+, then functools.lru_cache p

Re: pythonic way

2012-11-01 Thread inshu chauhan
OK ..I got it.. On Thu, Nov 1, 2012 at 5:54 PM, Zero Piraeus wrote: > : > > On 1 November 2012 11:32, inshu chauhan wrote: > > what is the most pythonic way to do this : > > > >if 0 < ix < 10 and 0 < iy < 10 ??? > > As everyone else has said, it's perfectly pythonic once yo

Re: python and Open cv

2012-11-01 Thread inshu chauhan
On Thu, Nov 1, 2012 at 7:02 PM, Paul Rudin wrote: > Zero Piraeus writes: > > > There aren't any rules about gmail (except the unwritten rule that to > > be a "real" geek you need to use a mail client that takes a whole > > weekend to configure, and another three years to properly understand). >

lazy properties?

2012-11-01 Thread Andrea Crotti
Seeing the wonderful "lazy val" in Scala I thought that I should try to get the following also in Python. The problem is that I often have this pattern in my code: class Sample: def __init__(self): self._var = None @property def var(self): if self._var is None:

Re: Negative array indicies and slice()

2012-11-01 Thread Ethan Furman
Ian Kelly wrote: On Thu, Nov 1, 2012 at 5:32 AM, Andrew Robinson wrote: Don't bother to fix the bug; allow Python to crash with a subtle bug that often take weeks to track down by the very small minority doing strange things (Equivalent to the "monkey patch" syndrome of D'Aprano; BTW: The long

Re: Negative array indicies and slice()

2012-11-01 Thread Ian Kelly
On Thu, Nov 1, 2012 at 5:32 AM, Andrew Robinson wrote: > H was that PEP the active state of Python, when Tim rejected the bug > report? Yes. The PEP was accepted and committed in March 2006 for release in Python 2.5. The bug report is from June 2006 has a version classification of Pytho

Re: Negative array indicies and slice()

2012-11-01 Thread Chris Angelico
On Thu, Nov 1, 2012 at 10:32 PM, Andrew Robinson wrote: > presently slice() allows memory leaks through GC loops. Forgive me if I've missed something here, but isn't it only possible to make a refloop by decidedly abnormal behaviour? Stuff like: a=[]; a.append(slice(a)) Seriously, who does this

Re: Negative array indicies and slice()

2012-11-01 Thread Andrew Robinson
On 11/01/2012 07:12 AM, Ethan Furman wrote: Andrew Robinson wrote: On 10/31/2012 02:20 PM, Ian Kelly wrote: On Wed, Oct 31, 2012 at 7:42 AM, Andrew Robinson wrote: Then; I'd note: The non-goofy purpose of slice is to hold three data values; They are either numbers or None. These *normall

Re: python and Open cv

2012-11-01 Thread Paul Rudin
Zero Piraeus writes: > There aren't any rules about gmail (except the unwritten rule that to > be a "real" geek you need to use a mail client that takes a whole > weekend to configure, and another three years to properly understand). Ha! 3 years? I've been using gnus for nearly 20 years and I st

Re: python and Open cv

2012-11-01 Thread Zero Piraeus
: On 1 November 2012 08:48, inshu chauhan wrote: > I am sorry.. but I need to know what are the rules and what about gmail ?? > Many people are using gmail to mail to the list. There aren't any rules about gmail (except the unwritten rule that to be a "real" geek you need to use a mail client th

Re: pythonic way

2012-11-01 Thread Zero Piraeus
: On 1 November 2012 11:32, inshu chauhan wrote: > what is the most pythonic way to do this : > >if 0 < ix < 10 and 0 < iy < 10 ??? As everyone else has said, it's perfectly pythonic once you stick the colon on the end. You might find it more instantly readable with some ext

Re: pythonic way

2012-11-01 Thread Ian Kelly
On Thu, Nov 1, 2012 at 9:32 AM, inshu chauhan wrote: > what is the most pythonic way to do this : > >if 0 < ix < 10 and 0 < iy < 10 ??? > I suppose you could do if all(0 < i < 10 for i in (ix, iy)): but I think that the original is more readable unless you have several

Re: Negative array indicies and slice()

2012-11-01 Thread Ethan Furman
Chris Angelico wrote: On Fri, Nov 2, 2012 at 1:12 AM, Ethan Furman wrote: In other words, the slice contains the strings, and my code calculates the offsets -- Python doesn't do it for me. That's correct, but you're still translating those strings into numeric indices. True, but the point i

Re: pythonic way

2012-11-01 Thread Terry Reedy
On 11/1/2012 11:32 AM, inshu chauhan wrote: what is the most pythonic way to do this : if 0 < ix < 10 and 0 < iy < 10 ??? end with : instead of ??? >>> ix, iy = 3,4 >>> if 0 < ix < 10 and 0 < iy < 10: print('This was too easy') This was too easy -- Ter

Re: pythonic way

2012-11-01 Thread Tim Chase
On 11/01/12 10:32, inshu chauhan wrote: > what is the most pythonic way to do this : > >if 0 < ix < 10 and 0 < iy < 10 ??? What's wrong with the syntax you provide? It's perfectly pythonic: ix = 42 yx = 3.14159 if 0 < ix < 10 and 0 < iy < 10: do_stuff(ix, iy) el

Re: pythonic way

2012-11-01 Thread MRAB
On 2012-11-01 15:32, inshu chauhan wrote: what is the most pythonic way to do this : if 0 < ix < 10 and 0 < iy < 10 ??? That looks Pythonic to me, except for the missing colon. -- http://mail.python.org/mailman/listinfo/python-list

How to remotely Automate GUI using pywinauto

2012-11-01 Thread Shambhu Rajak
Hi, Here I have a situation: I am trying to automate a GUI application and get some data from it. I tried using 'pywinauto' to launch the application and select the data and save it in -say notepad and later read it. This works fine when the script is locally run on the windows machine. My s

pythonic way

2012-11-01 Thread inshu chauhan
what is the most pythonic way to do this : if 0 < ix < 10 and 0 < iy < 10 ??? -- http://mail.python.org/mailman/listinfo/python-list

Re: Negative array indicies and slice()

2012-11-01 Thread Chris Angelico
On Fri, Nov 2, 2012 at 1:12 AM, Ethan Furman wrote: > In other words, the slice contains the strings, and my code calculates > the offsets -- Python doesn't do it for me. That's correct, but you're still translating those strings into numeric indices. You can slice a database record based on colu

Re: Negative array indicies and slice()

2012-11-01 Thread Ethan Furman
Andrew Robinson wrote: On 10/31/2012 02:20 PM, Ian Kelly wrote: On Wed, Oct 31, 2012 at 7:42 AM, Andrew Robinson wrote: Then; I'd note: The non-goofy purpose of slice is to hold three data values; They are either numbers or None. These *normally* encountered values can't create a memory l

Fwd: python and Open cv

2012-11-01 Thread inshu chauhan
-- Forwarded message -- From: inshu chauhan Date: Thu, Nov 1, 2012 at 1:26 PM Subject: Re: python and Open cv To: Mark Lawrence I am sorry.. but I need to know what are the rules and what about gmail ?? Many people are using gmail to mail to the list. On Thu, Nov 1, 2012 at 12

Re: datetime issue

2012-11-01 Thread Grant Edwards
On 2012-10-31, ru...@yahoo.com wrote: > On 10/31/2012 09:11 AM, Grant Edwards wrote:> On 2012-09-16, ?? > wrote: >> >>> Iam positng via google groups using chrome, thats all i know. >> >> Learn something else. Google Groups is seriously and permanently >> broken, and all posts fr

RE: Fastest web framework

2012-11-01 Thread Andriy Kornatskyy
Per community request turbogears and pysi were added. The following posts have been updated: http://mindref.blogspot.com/2012/09/python-fastest-web-framework.html http://mindref.blogspot.com/2012/10/python-web-pep8-consistency.html Comments or suggestions are welcome. Thanks. Andriy ---

Re: how to perform word sense disambiguation?

2012-11-01 Thread Robert Kern
On 11/1/12 5:14 AM, nachiket wrote: an initial part of my project involves assigning sense to each word in sentence. I came across this tool called wordnet. do share your views You can get access to Wordnet and a wide variety of useful tools in NLTK: http://nltk.org/ http://nltk.org/book/

Re: python and Open cv

2012-11-01 Thread Mark Lawrence
On 01/11/2012 08:55, inshu chauhan wrote: How to load a yml file in python and work with it ?? I used : import cv data = cv.Load("Z:/data/xyz_0_ 300.yml") But when I print data.. it just gives the detail of the image like number of rows and columns etc I want read what is t

Re: Negative array indicies and slice()

2012-11-01 Thread Robert Kern
On 10/31/12 8:16 PM, Andrew Robinson wrote: On 10/31/2012 02:20 PM, Ian Kelly wrote: On Wed, Oct 31, 2012 at 7:42 AM, Andrew Robinson wrote: Then; I'd note: The non-goofy purpose of slice is to hold three data values; They are either numbers or None. These *normally* encountered

Re: python and Open cv

2012-11-01 Thread Stefan H. Holek
On 01.11.2012, at 09:55, inshu chauhan wrote: > How to load a yml file in python and work with it ?? > Try one of these: http://pypi.python.org/pypi?%3Aaction=search&term=yaml&submit=search -- Stefan H. Holek ste...@epy.co.at -- http://mail.python.org/mailman/listinfo/python-list

Re: Obnoxious postings from Google Groups

2012-11-01 Thread Jamie Paul Griffin
/ Steven D'Aprano wrote on Wed 31.Oct'12 at 22:33:16 + / > On Wed, 31 Oct 2012 12:32:57 -0700, rurpy wrote: > I don't killfile merely for posting from Gmail or Google Groups, but > regarding your second point, it has seemed to me for some years now that > Gmail is the new Hotmail, which wa

Re: Obnoxious postings from Google Groups

2012-11-01 Thread Jamie Paul Griffin
/ Robert Miles wrote on Wed 31.Oct'12 at 0:39:02 -0500 / > For those of you running Linux: You may want to look into whether > NoCeM is compatible with your newsreader and your version of Linux. > It checks newsgroups news.lists.filters and alt.nocem.misc for lists > of spam posts, and will auto

python and Open cv

2012-11-01 Thread inshu chauhan
How to load a yml file in python and work with it ?? I used : import cv data = cv.Load("Z:/data/xyz_0_ 300.yml") But when I print data.. it just gives the detail of the image like number of rows and columns etc I want read what is there in the pixel of the image.. I tried to

Re: sort order for strings of digits

2012-11-01 Thread wxjmfauth
Le mercredi 31 octobre 2012 16:17:19 UTC+1, djc a écrit : > I learn lots of useful things from the list, some not always welcome. No > > sooner had I found a solution to a minor inconvenience in my code, than > > a recent thread here drew my attention to the fact that it will not work > > for