Re: Fast constant functions for Py2.5's defaultdict()

2007-02-13 Thread Giovanni Bajo
On 13/02/2007 20.01, Raymond Hettinger wrote: > FWIW, here are three ways of writing constant functions for > collections.defaultdict(): > > d = defaultdict(int) # slowest way; works only for zero > d = defaultdict(lambda: 0) # faster way; works for any constant > d = defaultdict(it

Is python2.5's Tix wrapper broken?

2007-02-13 Thread Ron Provost
I have a piece of software I wrote some time ago using Python and the Tix wrapper. I just upgraded to Python 2.5 and to my surprise my software no longer functions. There's a problem with the Tix wrapper. Under a clean install of Python the following should display an empty root window on th

FedEx UN Travel Destinations

2007-02-13 Thread Agent X
UN Spons.ored Southern Vacation Packages http://vacationdestiny.blogspot.com/ @-- d -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question about Class

2007-02-13 Thread JStoneGT
Thanks a lot.I've got it. En Tue, 13 Feb 2007 13:01:59 -0300, <[EMAIL PROTECTED]> escribió: > But I'm still confused that what's the "real dictionary"?I can't know > this > point.Please help and thanks again. I'm talking about a Python dictionary (a "real" one, as opposed to UserDic

Re: pygame and python 2.5

2007-02-13 Thread [EMAIL PROTECTED]
On Feb 13, 2:24 am, Steve Holden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Feb 11, 4:24 am, Steve Holden <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >>> On Feb 11, 1:35?am, Steve Holden <[EMAIL PROTECTED]> wrote: > [...] > > >>> By the way, on the sci.math newsgrou

Re: searching a list of lists as a two-dimensional array?

2007-02-13 Thread agent-s
Thanks for the help guys but I'm a newbie at this and from what I understand from the code, it looks like you guys are using a two dimensional array. I am not using a two dimensional array. Basically, it looks like this: [ [' ',' ',' ',' ',' ',' ',' ',' '], [' ',' ',' ',' ',' ',' ',' ',' '], [' ',

Re: searching a list of lists as a two-dimensional array?

2007-02-13 Thread agent-s
OK I just realized that a list of lists can be accessed in the same way a 2d array would be accessed. Thanks anyways guys. -- http://mail.python.org/mailman/listinfo/python-list

Re: Testers please

2007-02-13 Thread Scott David Daniels
Martien Friedeman wrote: > The size of the 'recording' is a major drawback, it was clearly not meant > to record the processing of millions of records. > > I need to find a way to specify the area in the code that needs recording. Use something like zlib and write a compressed log -- especially w

Please help about an instance var

2007-02-13 Thread JStoneGT
>>> from UserDict import UserDict >>> d = {1:2,3:4,5:6} >>> d1 = UserDict(d) >>> d1 {1: 2, 3: 4, 5: 6} >>> d1.data {1: 2, 3: 4, 5: 6} Here why both d1 and d1.data have the same values?As shown below,they're different types. >>> type(d1) >>> type(d1.data) Please help.Thanks! -- http

calling php function from python

2007-02-13 Thread mark
is it possible to call a php function from python and use a class from php in python? i want to use mmslib which creates mms messages and the only implementation is a php mmslib implementation. thanks a lot! mark -- http://mail.python.org/mailman/listinfo/python-list

barcode generation

2007-02-13 Thread mobiledreamers
Hi I want to generate barcode based on an input which can be numbers or numbers+alphabets. How do I do this? Is there any library that will doo this? thanks mark -- http://mail.python.org/mailman/listinfo/python-list

Re: can't find a way to display and print pdf through python.

2007-02-13 Thread jim-on-linux
For those who care, the file below should run on a unix/ linux style system. And "xpdf", amoung others, will run a pdf file. import os def Printpdf(): os.system( 'xpdf form.pdf' ) if __name__ == '__main__' : Printpdf() jim-on-linux > On Tue, 13 Feb 2007 08:44:18 GMT, Jussi Salm

How can this Perl regular expression be expressed in Python?

2007-02-13 Thread John Nagle
Here's a large Perl regular expression, from a Perl address parser in CPAN: use re 'eval'; $Addr_Match{street} = qr/ (?: # special case for addresses like 100 South Street (?:($Addr_Match{direct})\W+ (?{ $_{street} = $^N }) ($Addr_Mat

Re: Testers please

2007-02-13 Thread Martien Friedeman
Thanks for that for that Scott. Most of hassle is storing the program flow. For example: Iteration 3 of the loop starting on line 12 has itself a loop on line 15 that has 14 iterations. Iteration 4 of the loop starting on line 12 has a completely different set of iterations for the loop on line 1

threading and multicores, pros and cons

2007-02-13 Thread Maric Michaud
This is a recurrent problem I encounter when I try to sell python solutions to my customers. I'm aware that this problem is sometimes overlooked, but here is the market's law. I've heard of a bunch of arguments to defend python's choice of GIL, but I'm not quite sure of their technical backgrou

Re: threading and multicores, pros and cons

2007-02-13 Thread Paul Rubin
Maric Michaud <[EMAIL PROTECTED]> writes: > If some guru has made a good recipe, or want to resume the main points it > would be really appreciated. Basically Python applications are usually not too CPU-intensive; there are some ways you can get parallelism with reasonable extra effort; and for m

python not returning true

2007-02-13 Thread agent-s
I have a function, generally described as so: def function(args): if condition: if condition2: function(args+1) elif condition3: print "text" return True else: return False which is used in: if function(args):

Re: Is python2.5's Tix wrapper broken?

2007-02-13 Thread Gabriel Genellina
En Tue, 13 Feb 2007 22:10:54 -0300, Ron Provost <[EMAIL PROTECTED]> escribió: > Under Python2.5, the empty root window is displayed but I also get a > Traceback: > > Traceback (most recent call last): > File "", line 1, in > File "C:\Python25\lib\lib-tk\Tix.py", line 210, in __init__ > se

Re: python not returning true

2007-02-13 Thread Ben Finney
"agent-s" <[EMAIL PROTECTED]> writes: > I have a function, generally described as so: > > def function(args): > if condition: > if condition2: > function(args+1) > elif condition3: > print "text" > return True > else: > re

Re: python not returning true

2007-02-13 Thread John Machin
On Feb 14, 4:15 pm, "agent-s" <[EMAIL PROTECTED]> wrote: > I have a function, generally described as so: > > def function(args): > if condition: > if condition2: > function(args+1) return None > elif condition3: > print "text" >

Re: python not returning true

2007-02-13 Thread Steven D'Aprano
On Tue, 13 Feb 2007 21:15:19 -0800, agent-s wrote: > I have a function, generally described as so: [snip function] > which is used in: > > if function(args): > print "ok" > > so here basically "text" will print out when condition3 is true but it > will not print o

Re: calling php function from python

2007-02-13 Thread Gabriel Genellina
En Tue, 13 Feb 2007 23:52:37 -0300, mark <[EMAIL PROTECTED]> escribió: > is it possible to call a php function from python and use a class from > php in python? i want to use mmslib which creates mms messages and the > only implementation is a php mmslib implementation. > thanks a lot! > mark I d

Re: Segmentation faults using threads

2007-02-13 Thread Hendrik van Rooyen
"Mathias" <[EMAIL PROTECTED]> wrote: > Does someone have experience with threading in python - are there > non-threadsafe functions I should know about? how do your threads communicate with one another - are there any globals that are accessed from different threads? strange this - you should

Recursive calls and stack

2007-02-13 Thread [EMAIL PROTECTED]
Hi, I have a program which literately finds the object that overlapping a point. The horizontal and vertical search are called recursively from inside each other. Is this way of implementation fill the stack space with the local variables inside each call. If this is not good, is there a better w

Re: Please help about an instance var

2007-02-13 Thread Gabriel Genellina
En Tue, 13 Feb 2007 23:54:29 -0300, <[EMAIL PROTECTED]> escribió: from UserDict import UserDict d = {1:2,3:4,5:6} d1 = UserDict(d) d1 > {1: 2, 3: 4, 5: 6} d1.data > {1: 2, 3: 4, 5: 6} > Here why both d1 and d1.data have the same values?As shown below,they're > different

Re: barcode generation

2007-02-13 Thread Gabriel Genellina
En Wed, 14 Feb 2007 00:56:14 -0300, <[EMAIL PROTECTED]> escribió: > I want to generate barcode based on an input which can be numbers or > numbers+alphabets. > How do I do this? Is there any library that will doo this? Try google... -- Gabriel Genellina -- http://mail.python.org/mailman/list

Re: How can this Perl regular expression be expressed in Python?

2007-02-13 Thread Gabriel Genellina
En Wed, 14 Feb 2007 01:07:33 -0300, John Nagle <[EMAIL PROTECTED]> escribió: > Here's a large Perl regular expression, from a Perl address parser in > CPAN: > > use re 'eval'; > $Addr_Match{street} = qr/ > (?: ># special case for addresses like 100 South Street >

Re: threading and multicores, pros and cons

2007-02-13 Thread Maric Michaud
Le mercredi 14 février 2007 05:49, Paul Rubin a écrit : > Basically Python applications are usually not too CPU-intensive; there > are some ways you can get parallelism with reasonable extra effort; Basically, while not CPU intensive, application server needs to get benefit of all resources of the

Re: How can this Perl regular expression be expressed in Python?

2007-02-13 Thread John Nagle
Gabriel Genellina wrote: > En Wed, 14 Feb 2007 01:07:33 -0300, John Nagle <[EMAIL PROTECTED]> > escribió: > >> Here's a large Perl regular expression, from a Perl address parser in >> CPAN: >> >> use re 'eval'; >> $Addr_Match{street} = qr/ >> (?: >># special case

Re: threading and multicores, pros and cons

2007-02-13 Thread Paul Rubin
Maric Michaud <[EMAIL PROTECTED]> writes: > Le mercredi 14 février 2007 05:49, Paul Rubin a écrit : > > Basically Python applications are usually not too CPU-intensive; there > > are some ways you can get parallelism with reasonable extra effort; > Basically, while not CPU intensive, application s

Re: Recursive calls and stack

2007-02-13 Thread Gabriel Genellina
En Wed, 14 Feb 2007 03:09:37 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > Hi, > I have a program which literately finds the object that overlapping a > point. The horizontal and vertical search are called recursively from > inside each other. > Is this way of implementation fill th

Re: python not returning true

2007-02-13 Thread agent-s
On Feb 13, 9:37 pm, "John Machin" <[EMAIL PROTECTED]> wrote: > On Feb 14, 4:15 pm, "agent-s" <[EMAIL PROTECTED]> wrote: > > > I have a function, generally described as so: > > > def function(args): > > if condition: > > if condition2: > > function(args+1) > > r

Re: How can this Perl regular expression be expressed in Python?

2007-02-13 Thread Gabriel Genellina
En Wed, 14 Feb 2007 04:11:37 -0300, John Nagle <[EMAIL PROTECTED]> escribió: > Gabriel Genellina wrote: >> En Wed, 14 Feb 2007 01:07:33 -0300, John Nagle <[EMAIL PROTECTED]> >> escribió: >> >>> Here's a large Perl regular expression, from a Perl address parser in >>> CPAN: >>> >>> use re 'ev

Re: python not returning true

2007-02-13 Thread John Machin
On Feb 14, 5:45 pm, "agent-s" <[EMAIL PROTECTED]> wrote: > On Feb 13, 9:37 pm, "John Machin" <[EMAIL PROTECTED]> wrote: > > > > > On Feb 14, 4:15 pm, "agent-s" <[EMAIL PROTECTED]> wrote: > > > > I have a function, generally described as so: > > > > def function(args): > > > if condition: > > >

Re: Recursive calls and stack

2007-02-13 Thread [EMAIL PROTECTED]
On Feb 14, 11:45 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 14 Feb 2007 03:09:37 -0300, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> escribió: > > > Hi, > > I have a program which literately finds the object that overlapping a > > point. The horizontal and vertical search are called r

<    1   2