Re: Cancelling events on a COM Object

2007-08-16 Thread Roger Upole
Oliver Nelson wrote: >I have MapPoint working in Python, and I'm trying to cancel events on the map, >but I can't seem to make that happen. I'm >responding to the events successfully in my panel object. My code is like >this: > > global MapPointMod > MapPointMod = > win32com.client.gencache.

Re: Pass by reference or by value?

2007-08-16 Thread Steve Holden
Robert Dailey wrote: [but he top-posted, so he should consider himself smacked on the wrist] > On 8/16/07, *Steve Holden* <[EMAIL PROTECTED] > > wrote: > > Robert Dailey wrote: > > So immutable objects cannot be modified directly? I guess this means > > int

Re: Pass by reference or by value?

2007-08-16 Thread Steve Holden
Thomas Jollans wrote: > On Thursday 16 August 2007, Robert Dailey wrote: >> Hi, >> >> I previously created a topic named "Pass by reference or by value" where I >> inquired on how python's function parameters work. I received a lot of nice >> responses, however I'm still confused on the topic. Note

Re: How to say $a=$b->{"A"} ||={} in Python?

2007-08-16 Thread beginner
On Aug 16, 6:21 pm, James Stroud <[EMAIL PROTECTED]> wrote: > beginner wrote: > > Hi All. > > > I'd like to do the following in more succint code: > > > if k in b: > > a=b[k] > > else: > > a={} > > b[k]=a > > > a['A']=1 > > > In perl it is just one line: $a=$b->{"A"} ||={}. > > I'm afra

Re: How to say $a=$b->{"A"} ||={} in Python?

2007-08-16 Thread Jonathan Gardner
On Aug 16, 3:35 pm, beginner <[EMAIL PROTECTED]> wrote: > > In perl it is just one line: $a=$b->{"A"} ||={}. > a = b.setdefault('A', {}) This combines all two actions together: - Sets b['A'] to {} if it is not already defined - Assigns b['A'] to a More info on dict methods here: http://docs.pyt

Re: How to say $a=$b->{"A"} ||={} in Python?

2007-08-16 Thread Paul McGuire
On Aug 16, 8:28 pm, Jonathan Gardner <[EMAIL PROTECTED]> wrote: > On Aug 16, 3:35 pm, beginner <[EMAIL PROTECTED]> wrote: > > > > > In perl it is just one line: $a=$b->{"A"} ||={}. > > a = b.setdefault('A', {}) > > This combines all two actions together: > - Sets b['A'] to {} if it is not already d

Re: How to say $a=$b->{"A"} ||={} in Python?

2007-08-16 Thread Paul McGuire
On Aug 16, 6:03 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Aug 16, 6:35 pm, beginner <[EMAIL PROTECTED]> wrote: > > > Hi All. > > > I'd like to do the following in more succint code: > > > if k in b: > > a=b[k] > > else: > > a={} > > b[k]=a > > > a['A']=1 > > > In perl it is just on

Re: How to say $a=$b->{"A"} ||={} in Python?

2007-08-16 Thread James Stroud
beginner wrote: > On Aug 16, 6:21 pm, James Stroud <[EMAIL PROTECTED]> wrote: >>I'm afraid you've asked a non sequiter: >> >>euler 40% cat test.pl >> >>$a=$b->{"A"} ||={} ; >>print "$a\n" ; >> >>$b->{"B"} = 0 ; >>$a=$b->{"B"} ||={} ; >>print "$a\n" ; >> >>$b->{"X"} = 15 ; >>$a=$b->{"X"} ||={} ; >>p

Re: How to say $a=$b->{"A"} ||={} in Python?

2007-08-16 Thread Paul McGuire
On Aug 16, 7:53 pm, beginner <[EMAIL PROTECTED]> wrote: > On Aug 16, 6:21 pm, James Stroud <[EMAIL PROTECTED]> wrote: > > > > > > > beginner wrote: > > > Hi All. > > > > I'd like to do the following in more succint code: > > > > if k in b: > > > a=b[k] > > > else: > > > a={} > > > b[k]=

to property or function in class object

2007-08-16 Thread james_027
hi, i am very new to python, not knowing much about good design. I have an object here for example a Customer object, where I need to retrieve a info which has a number of lines of code to get it. my question is weather what approach should I use? to use the property which is from the python new

Re: How to say $a=$b->{"A"} ||={} in Python?

2007-08-16 Thread Carsten Haese
On Fri, 2007-08-17 at 00:53 +, beginner wrote: > $b is supposed to be a hash-table of hash-table. If a key exists in > $b, it points to another hash table. The $a=$b->{"A"} ||={} pattern is > useful when you want to add records to the double hash table. > > For example, if you have a series of

why psyco using more memery in liunx?

2007-08-16 Thread Kyo Guan
Hi all: When you import psyco in python2.5, you can see the memery grow up near 40MB in linux. but the same version python and psyco, is only grow up 1MB under windows. kyo -- http://mail.python.org/mailman/listinfo/python-list

why psyco using more memery in liunx?

2007-08-16 Thread kyo guan
Hi all: When you import psyco in python2.5, you can see the memery grow up near 40MB in linux. but the same version python and psyco, is only grow up 1MB under windows. kyo -- http://mail.python.org/mailman/listinfo/python-list

Re: clarification

2007-08-16 Thread Michael Bentley
On Aug 16, 2007, at 2:42 AM, Beema shafreen wrote: hi every body, i have compared two files: code: fh = open('HPRD_MAIN_20.txt','r') for line in fh.readlines(): data = line.strip().split('#') fh1 = open('NOMENCLATURE_MAIN_20.txt','r') for line1 in fh1.readlines():

Re: How to say $a=$b->{"A"} ||={} in Python?

2007-08-16 Thread beginner
On Aug 16, 9:32 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Fri, 2007-08-17 at 00:53 +, beginner wrote: > > $b is supposed to be a hash-table of hash-table. If a key exists in > > $b, it points to another hash table. The $a=$b->{"A"} ||={} pattern is > > useful when you want to add record

Re: How to say $a=$b->{"A"} ||={} in Python?

2007-08-16 Thread beginner
On Aug 16, 5:35 pm, beginner <[EMAIL PROTECTED]> wrote: > Hi All. > > I'd like to do the following in more succint code: > > if k in b: > a=b[k] > else: > a={} > b[k]=a > > a['A']=1 > > In perl it is just one line: $a=$b->{"A"} ||={}. > > Thanks, > Geoffrey It looks like defaultdict is

Re: why psyco using more memery in liunx?

2007-08-16 Thread Steve Holden
kyo guan wrote: > Hi all: > > When you import psyco in python2.5, you can see the memery grow up near > 40MB in linux. but the same version python and > psyco, is only grow up 1MB under windows. > Please don't repeat the question again. It *has* reached the list. Patience is a virtue ...

defaultdict of arbitrary depth

2007-08-16 Thread Paul McGuire
In responding to another post on defaultdict, I posted an implementation of a 2-level hashtable, by creating a factory method that returned a defaultdict(dict). The OP of that other thread was trying to build a nested tree from a set of n-tuples, in which the first (n-1) values in each tuple were

Re: How to say $a=$b->{"A"} ||={} in Python?

2007-08-16 Thread James Stroud
beginner wrote: > On Aug 16, 9:32 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > >>On Fri, 2007-08-17 at 00:53 +, beginner wrote: >> >>>$b is supposed to be a hash-table of hash-table. If a key exists in >>>$b, it points to another hash table. The $a=$b->{"A"} ||={} pattern is >>>useful when y

Re: Memory leak when creating lots of object

2007-08-16 Thread Godzilla
On Aug 16, 1:13 am, Paul Moore <[EMAIL PROTECTED]> wrote: > On 14 Aug, 05:57, Godzilla <[EMAIL PROTECTED]> wrote: > > > Hello, > > > I have a program that create and pop an object off a queue, but it is > > experiencing some memory leakage. I have been unable to detect where > > the memory leakage

Re: How to say $a=$b->{"A"} ||={} in Python?

2007-08-16 Thread Carsten Haese
On Fri, 17 Aug 2007 03:15:10 -, beginner wrote > On Aug 16, 9:32 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > > What is the best solution in Perl need not be the best solution in > > Python. In Python you should just use a tuple as your dict key, i.e. > > a[k1,k2] = v, unless you have some ot

Re: defaultdict of arbitrary depth

2007-08-16 Thread Carsten Haese
On Thu, 2007-08-16 at 20:25 -0700, Paul McGuire wrote: > [...] > I've hacked out this recursivedefaultdict which is a > defaultdict(defaultdict(defaultdict(...))), arbitrarily deep depending > on the keys provided in the reference. > > Please comment. > [...] > > class recursivedefaultdict(object

Re: about negative polar plots

2007-08-16 Thread greg
yadin wrote: > hi am doing a polar plot of the radiation pattern of an antenna. > the polar plots represents the value of the power in dB's and the dB > go from -40dB to 0dB Add 40 so that the range goes from 0 to 40, then plot that to an appropriate scale. -- Greg -- http://mail.python.org/mail

Re: defaultdict of arbitrary depth

2007-08-16 Thread Paul McGuire
On Aug 16, 11:19 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Thu, 2007-08-16 at 20:25 -0700, Paul McGuire wrote: > > [...] > > I've hacked out this recursivedefaultdict which is a > > defaultdict(defaultdict(defaultdict(...))), arbitrarily deep depending > > on the keys provided in the refere

Re: defaultdict of arbitrary depth

2007-08-16 Thread Carsten Haese
On Thu, 2007-08-16 at 21:27 -0700, Paul McGuire wrote: > Of course, very short and sweet! Any special reason you wrote: > self.default_factory = type(self) > instead of: > self.default_factory = recursivedefaultdict > ? Besides a pathological need to be clever? ;) The former keeps

Subprocess & ffmpeg

2007-08-16 Thread Andrew Bloomgarden
Hi, I'm having a problem with the subprocess module. I'm using it to run ffmpeg with the following command, where a_cmd is the command string. proc = subprocess.Popen (a_cmd,shell=True,stdout=subprocess.PIPE,universal_newlines=True,stderr= subprocess.STDOUT,stdin=subprocess.PIPE) Then, I'

One Python in a Pub, with 100 Rails Developers...

2007-08-16 Thread Simon Wittber
Python helped deliver the goods last Wednesday evening in front of a one hundred strong crowd of Rails hecklers... Video footage here: http://blog.scouta.com/2007/08/16/iccarus/ ...just kidding, they were all great chaps, and only a few were Rails devs, and only a few of them were hecklers :-) I

using super() to call two parent classes __init__() method

2007-08-16 Thread 7stud
When I run the following code and call super() in the Base class's __init__ () method, only one Parent's __init__() method is called. class Parent1(object): def __init__(self): print "Parent1 init called." self.x = 10 class Parent2(object): def __init__(self): pr

Re: using super() to call two parent classes __init__() method

2007-08-16 Thread Alex Martelli
7stud <[EMAIL PROTECTED]> wrote: > When I run the following code and call super() in the Base class's > __init__ () method, only one Parent's __init__() method is called. > > > class Parent1(object): > def __init__(self): > print "Parent1 init called." > self.x = 10 > > cla

Re: defaultdict of arbitrary depth

2007-08-16 Thread Steve Holden
Paul McGuire wrote: > On Aug 16, 11:19 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: >> On Thu, 2007-08-16 at 20:25 -0700, Paul McGuire wrote: >>> [...] >>> I've hacked out this recursivedefaultdict which is a >>> defaultdict(defaultdict(defaultdict(...))), arbitrarily deep depending >>> on the keys

Re: using super() to call two parent classes __init__() method

2007-08-16 Thread Steve Holden
7stud wrote: > When I run the following code and call super() in the Base class's > __init__ () method, only one Parent's __init__() method is called. > > > class Parent1(object): > def __init__(self): > print "Parent1 init called." > self.x = 10 > > class Parent2(object): >

Re: to property or function in class object

2007-08-16 Thread Marc 'BlackJack' Rintsch
On Fri, 17 Aug 2007 02:29:47 +, james_027 wrote: > i am very new to python, not knowing much about good design. I have an > object here for example a Customer object, where I need to retrieve a > info which has a number of lines of code to get it. > > my question is weather what approach shou

clarification

2007-08-16 Thread Beema shafreen
hi everybody, i have a file with data separated by tab mydata: fhl1fkh2 dfp1chk1 mal3alp14 mal3moe1 mal3spi1 mal3bub1 mal3bub3 mal3mph1 mal3mad3 hob1nak1 hob1wsp1 hob1rad3 cdr2cdc13 cdr2cdc2 shows these two are separated by tab represented as

<    1   2