Re: To count number of quadruplets with sum = 0

2007-03-15 Thread Paul Rubin
"n00m" <[EMAIL PROTECTED]> writes: > http://rapidshare.com/files/21267938/m1000.txt > http://rapidshare.com/files/21268386/m4000.txt I get 33190970 for the first set and 0 for the second set. The first set only makes 38853 distinct dictionary entries, I guess because the numbers are all fairly sm

Re: getting local system information with python

2007-03-15 Thread Justin Ezequiel
On Mar 16, 2:27 pm, Astan Chee <[EMAIL PROTECTED]> wrote: > Hi, > I have a python script and I want to check what operating system it is > on and what the current local machine name is. > How do I do it with python? > Thanks! > Astan import platform platform.uname() -- http://mail.python.org/mai

Re: problem with str()

2007-03-15 Thread Petr Prikryl
"Alex Martelli" wrote > Steve Holden wrote: >... > > >> Get yourself a stuffed bear, and next time you have this kind of problem > > >> spend a few minutes explaining to the bear exactly how your program > > >> can't possibly be wrong. Works like a charm. > > > > > > A rubber ducky works muc

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread n00m
For those who interested, my test input files: http://rapidshare.com/files/21267938/m1000.txt http://rapidshare.com/files/21268386/m4000.txt -- http://mail.python.org/mailman/listinfo/python-list

Re: Circular Class Logic

2007-03-15 Thread Paul McGuire
On Mar 15, 9:02 pm, [EMAIL PROTECTED] wrote: > > > How is that (using 'super') really different from this: > > class Disk(Folder): > def __init__(self,driveLetter): > Folder.Folder.__init__(self, driveLetter + ":/") > Google for "python super" - there is documentation on this, plus some inte

Re: lock problem

2007-03-15 Thread Leo Kislov
On Mar 15, 2:31 pm, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: [snip] > os.environ['__kabc_ldap'] = temp_file_name [snip] > Now as per the above code, "aa" is the first string which will be executed in > Thread-1. In my query to the ldap server, I am getting a record which matches > t

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread n00m
Steve, imo strangely enough but your suggestion to replace "if...: else:..." with x_y = x + y h[x_y] = h.get(x_y, 1) s=l=o=w=e=d the thing by ~1 sec. -- http://mail.python.org/mailman/listinfo/python-list

getting local system information with python

2007-03-15 Thread Astan Chee
Hi, I have a python script and I want to check what operating system it is on and what the current local machine name is. How do I do it with python? Thanks! Astan -- http://mail.python.org/mailman/listinfo/python-list

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread Michael Spencer
n00m wrote: > http://www.spoj.pl/problems/SUMFOUR/ > > 3 > 0 0 0 0 > 0 0 0 0 > -1 -1 1 1 > Answer for this input data is 33. > > My solution for the problem is > == > > import time > t = time.clock() > > q,w,e,r,sch,h = [],[],[

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread Paul Rubin
"n00m" <[EMAIL PROTECTED]> writes: > Two first outputs is of above (your) code; next two - of my code: Yeah, I see now that we both used the same algorithm. At first glance I thought you had done something much slower. The 10 second limit they gave looks like they intended to do it about this wa

Re: Pickle Problem

2007-03-15 Thread 7stud
> I'm trying to make the transition from Java > The biggest thing that was messing me up was the > mandatory "self" input. For some reason I was thinking > that, if I had parenthesis, I would have to define it. I think things are pretty similar in Java. Java does the same thing except 'self' is

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread Paul Rubin
"n00m" <[EMAIL PROTECTED]> writes: > h = collections.defaultdict(itertools.repeat(0).next) Something wrong with h = collections.defaultdict(int) ? > for x in e: > for y in r: > sch += h[-(x + y)] That scares me a little: I think it makes a new entry in h, for the cases where -(x+y)

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread n00m
Paul, import time t = time.clock() f = open("D:/m4000.txt","rt") npairs = int(f.readline()) quads = [map(int, f.readline().split()) for i in xrange(npairs)] f.close() da = {} for p in quads: for q in quads: z = p[2] + q[3] da[z] = da.get(z,0) + 1 print sum(da.get(-(p[0]+q[1]),

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread n00m
Steven, I ran this: import time, collections, itertools t = time.clock() q,w,e,r,sch = [],[],[],[],0 h = collections.defaultdict(itertools.repeat(0).next) f = open("D:/m4000.txt","rt") for o in range(int(f.readline())): row = map(int, f.readline().split()) q.append(row[0]) w.append(row[1

Need help with apack compression code

2007-03-15 Thread priya kale
I need to code for decompressing the file which is compressed using Apack, I am supposed to code it in visual c++, Plz help me finding algorithm compatible to Widows based C or c++. Regards, Priya Kale (Pune) -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with str()

2007-03-15 Thread Alex Martelli
Steve Holden <[EMAIL PROTECTED]> wrote: ... > >> Get yourself a stuffed bear, and next time you have this kind of problem > >> spend a few minutes explaining to the bear exactly how your program > >> can't possibly be wrong. Works like a charm. > > > > A rubber ducky works much better for that,

python noob, multiple file i/o

2007-03-15 Thread hiro
Hi there, I'm very new to python, the problem I need to solve is whats the "best/ simplest/cleanest" way to read in multiple files (ascii), do stuff to them, and write them out(ascii). -- import os filePath = ('O:/spam/eggs/') for file in os.listdir(filePath): #straight from docs # iterate

Import Error with embedded python

2007-03-15 Thread Lane Brooks
When I run a particular python script from an embedded interpreter, I get the following ImportError: File "di.py", line 14, in load from xml.dom.ext.reader import Sax2 File "/usr/lib64/python2.4/site-packages/_xmlplus/dom/ext/reader/__init__.py", line 14, in ? import string, url

Re: Eureka moments in Python

2007-03-15 Thread Alex Martelli
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I'd be interested in hearing people's stories of Eureka moments in Python, > moments where you suddenly realise that some task which seemed like it > would be hard work was easy with Python. As a part of my process to decide whether Python was the righ

Re: problem with str()

2007-03-15 Thread 7stud
On Mar 15, 5:31 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > The fact that a list comprehension "leaks" its variables into the > containing scope is a bit weird. > A generator expression doesn't: > > py> str > > py> w = (str for str in range(10)) > py> w > > py> str > > py> w.next() >

Re: Subclassing: what is wrong here?

2007-03-15 Thread Paulo da Silva
Miki escreveu: > Hello Paulo, > >> What's wrong with this way of subclassing? >> ... > See > http://sourceforge.net/tracker/index.php?func=detail&aid=1448640&group_id=5470&atid=105470 > > HTH, > -- > Miki <[EMAIL PROTECTED]> > http://pythonwise.blogspot.com > Thanks! It works this way: class

Re: Pickle Problem

2007-03-15 Thread Alex Martelli
Gary Herron <[EMAIL PROTECTED]> wrote: ... > fixed, I see another bit of trouble. The pickle format is a binary > format (be default), but you don't open the file in binary mode. On Alas, wish it were:-(. Unfortunately, snipping the right snippet from help(pickle) ...: """ | Th

Re: problem with str()

2007-03-15 Thread Steve Holden
Alex Martelli wrote: > Steve Holden <[EMAIL PROTECTED]> wrote: > >> 7stud wrote: >>> Sheesh! You would think that after looking at every inch of the code >>> for way too many hours, at some point that would have poked me in the >>> eye. >>> >>> Thanks all. >>> >> Get yourself a stuffed bear, and n

Re: Python Eggs on Cygwin

2007-03-15 Thread Sick Monkey
Just by looking at the "permission denied" error, when you loaded the MySQLdb module, were you using a specific user (is it owned by a specific user)? On 15 Mar 2007 17:33:29 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hi, I'm trying to use MySQL Python module on Cygwin. Since there

Re: Python shell on mac os x

2007-03-15 Thread Alex Martelli
Bert Heymans <[EMAIL PROTECTED]> wrote: > Hi! > > I'm using iTerm on the mac the keymapping isn't right. On Linux and > Windows it's really nice to be able to hit up to get the previous > command. Does anyone know a way to get the Pyhton shell to work like > on other systems, I always get this wh

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread Paul Rubin
Paul Rubin writes: > print sum([da.get(-(p[0]+q[1]), 0) for p in quads for q in quads]) The above should say: print sum(da.get(-(p[0]+q[1]), 0) for p in quads for q in quads) I had to use a listcomp instead of a genexp for testing, since I'm still using python 2.3, a

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread Paul Rubin
"n00m" <[EMAIL PROTECTED]> writes: > http://www.spoj.pl/problems/SUMFOUR/ > 3 > 0 0 0 0 > 0 0 0 0 > -1 -1 1 1 > Answer for this input data is 33. f = open('input1') npairs = int(f.readline()) quads = [map(int, f.readline().split()) for i in xrange(npairs)] assert len(quads) == npairs da = {} fo

Re: problem with str()

2007-03-15 Thread Alex Martelli
Steve Holden <[EMAIL PROTECTED]> wrote: > 7stud wrote: > > Sheesh! You would think that after looking at every inch of the code > > for way too many hours, at some point that would have poked me in the > > eye. > > > > Thanks all. > > > Get yourself a stuffed bear, and next time you have this ki

Re: Returning other instance from __init__

2007-03-15 Thread Alex Martelli
Paulo da Silva <[EMAIL PROTECTED]> wrote: > Alex Martelli escreveu: > > Paulo da Silva <[EMAIL PROTECTED]> wrote: > ... > > > > > E.g.: > > > > class C1(object): > > def __new__(cls, xxx): > > if xxx: return type.__new__(cls, xxx) > > else: return C1.load(xxx) > > @stati

Re: Python COM called from VB/Delphi

2007-03-15 Thread Gabriel Genellina
En Wed, 14 Mar 2007 21:17:12 -0300, Larry Bates <[EMAIL PROTECTED]> escribió: > I have a rather large Python class that I've converted to > a COM object. I can dispatch (using either Python or VB) > and call the methods perfectly. Now a new client wants > to call it from Delphi. Can anyone ou

Re: Python shell on mac os x

2007-03-15 Thread Sick Monkey
I use iTerm and it took me a while to get use to it as well. All you have to do is go to "Bookmarks-> Manage Profiles" Then expand "Terminal Profiles ->Default" and then for "type" select "linux". You may have to restart iTerm, but you will be able to do everything you can in linux. Let me kno

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread Steven Bethard
n00m wrote: > http://www.spoj.pl/problems/SUMFOUR/ > > 3 > 0 0 0 0 > 0 0 0 0 > -1 -1 1 1 > Answer for this input data is 33. > > My solution for the problem is > == > > import time > t = time.clock() > > q,w,e,r,sch,h = [],[],[

Re: Circular Class Logic

2007-03-15 Thread half . italian
> > How is that really different from this: > > > class Disk(Folder): > > def __init__(self,driveLetter): > > Folder.Folder.__init__(self.path) # ??? Being that Folder is the > > superclass? > > Where did self.path come from? Even though Folder is the superclass, > self.path doesn't exist u

Registration Open for South Florida Software Symposium 2007

2007-03-15 Thread miamijug
We are happy to announce the South Florida Software Symposium 2007. South Florida Software Symposium May 18 - 20, 2007 Hotel Intercontinental Miami West 2505 Northwest 87th Avenue Miami, Florida 33172 http://www.nofluffjuststuff.com/sh/2007-05-Miami The NFJS Symposium Tour is coming to South Fl

Re: newb: Python Floating Point

2007-03-15 Thread Dan Bishop
On Mar 15, 6:09 pm, "johnny" <[EMAIL PROTECTED]> wrote: > When I do the following, rounding to 2 decimal places doesn't seem to > work. I should get 0.99 : In binary, 0.99 is the recurring fraction 0.11 010111101000 010111101000 010111101000 Thus, it can't be exactly

Re: newb: Python Floating Point

2007-03-15 Thread Robert Kern
johnny wrote: > When I do the following, rounding to 2 decimal places doesn't seem to > work. I should get 0.99 : > a =0.99 a > 0.98999 round(a,2) > 0.98999 http://docs.python.org/tut/node16.html -- Robert Kern "I have come to believe that the whole worl

Re: Subclassing: what is wrong here?

2007-03-15 Thread Miki
Hello Paulo, > What's wrong with this way of subclassing? > ... See http://sourceforge.net/tracker/index.php?func=detail&aid=1448640&group_id=5470&atid=105470 HTH, -- Miki <[EMAIL PROTECTED]> http://pythonwise.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Python Eggs on Cygwin

2007-03-15 Thread [EMAIL PROTECTED]
Hi, I'm trying to use MySQL Python module on Cygwin. Since there is no binary package, I compiled MySQL C client library and Python module (http://sourceforge.net/projects/mysql-python) manually. But when I was trying to load MySQLdb module, following errors happened. >>> import MySQLdb Traceba

"urlopen" not thread safe

2007-03-15 Thread John Nagle
I was looking at the code for "urllib", and there's some undocumented "FTP cacheing" code in there that's not thread safe. The documentation for "urllib" Is there any good reason to keep that code in "urllib"? Unless something critical uses that undocumented feature, that code probably oug

newb: Python Floating Point

2007-03-15 Thread johnny
When I do the following, rounding to 2 decimal places doesn't seem to work. I should get 0.99 : >>> a =0.99 >>> a 0.98999 >>> round(a,2) 0.98999 >>> thank you. -- http://mail.python.org/mailman/listinfo/python-list

Subclassing: what is wrong here?

2007-03-15 Thread Paulo da Silva
Hi! What's wrong with this way of subclassing? from datetime import date class MyDate(date): def __init__(self,year,month=None,day=None): if type(year) is str: # The whole date is here as a string year,month,day=map(int,stri

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread n00m
Your suggestion speeded it up 1.5 times (on my 4000 test input rows)! -- http://mail.python.org/mailman/listinfo/python-list

Re: mod_python demo

2007-03-15 Thread Gabriel Genellina
En Wed, 14 Mar 2007 09:02:36 -0300, Jan Danielsson <[EMAIL PROTECTED]> escribió: > Hello all, > >I have written a web-based voting system (add question, add possible > answers to that question, and let users vote) in python. It uses: [...] >Is there any Python/web community site anywhere

Re: lock problem

2007-03-15 Thread Gabriel Genellina
En Thu, 15 Mar 2007 18:31:29 -0300, Ritesh Raj Sarraf <[EMAIL PROTECTED]> escribió: > I'm not sure if there's something wrong in the code mentioned above or > is it > really a lock problem. Try to break the code into smaller pieces to see what is wrong. It's too long for somebody to try to

Re: problem with str()

2007-03-15 Thread Paul Rubin
[EMAIL PROTECTED] writes: > methodList = [str for str in names if callable(getattr(obj, str))] > > instead, do something like this: > > methodList = [i for i in names if callable(getattr(obj, i))] or: methodList = list(str for str in names if callable(getattr(obj, str))) genexps, unlike lis

Re: problem with str()

2007-03-15 Thread Gabriel Genellina
En Thu, 15 Mar 2007 17:32:24 -0300, <[EMAIL PROTECTED]> escribió: > methodList = [str for str in names if callable(getattr(obj, str))] > > instead, do something like this: > > methodList = [i for i in names if callable(getattr(obj, i))] The fact that a list comprehension "leaks" its variables int

Re: Problem I have with a while loop/boolean/or

2007-03-15 Thread Gabriel Genellina
En Wed, 14 Mar 2007 15:34:20 -0300, Fabio FZero <[EMAIL PROTECTED]> escribió: > Why don't you try this instead: > > hint = raw_input("\nAre you stuck? y/n: ") > hint = hint.lower() > > while not hint in 'yn': > hint = raw_input("Please specify a valid choice: ") Dangerous: what if the user

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread Matimus
> Any ideas to speed it up say 10 times? Or the problem only for C-like > langs? I dout this will speed it up by a factor of 10, but in your solution you are mapping the values in the input file to longs. The problem statement states that the maximum value for any of the numbers is 2**28. I assume

Re: Python COM called from VB/Delphi

2007-03-15 Thread Michał Zaborowski
Hi, Larry Bates wrote: > I have a rather large Python class that I've converted to > a COM object. I can dispatch (using either Python or VB) > and call the methods perfectly. Now a new client wants > to call it from Delphi. Can anyone out there give me > any pointers on how that would be done.

Re: problem with str()

2007-03-15 Thread Steve Holden
7stud wrote: > Sheesh! You would think that after looking at every inch of the code > for way too many hours, at some point that would have poked me in the > eye. > > Thanks all. > Get yourself a stuffed bear, and next time you have this kind of problem spend a few minutes explaining to the bear

To count number of quadruplets with sum = 0

2007-03-15 Thread n00m
http://www.spoj.pl/problems/SUMFOUR/ 3 0 0 0 0 0 0 0 0 -1 -1 1 1 Answer for this input data is 33. My solution for the problem is == import time t = time.clock() q,w,e,r,sch,h = [],[],[],[],0,{} f = open("D:/m4000.txt","rt")

Re: what are Python equivalent to MATLAB persistent or C++ static?

2007-03-15 Thread sturlamolden
On Mar 15, 8:09 am, "dmitrey" <[EMAIL PROTECTED]> wrote: > Thank you in advance, > Dmitrey First, "static" can mean at least three different things in C++: static int myvar1; void foobar() { static int myvar2; } class foobar { static int myvar3; } I assume you are thinking about the seco

lock problem

2007-03-15 Thread Ritesh Raj Sarraf
Hi, I think there is some lock problem. Let me show the code first import os import sys import string import tempfile import threading import Queue from time import sleep _hostname = None _username = None _password = None _ldapDataFile = None if _hostname is None or _username is None or _pass

Re: os.path.isfile with *.tar.gz

2007-03-15 Thread Bruno Desthuilliers
> Boudreau, Emile wrote: (snip) >> I have tried variations of: os.path.isfile( os.path.join("C:\\temp\\", >> "rqp-win32-app", "*.tar.gz")) As a side note, the whole point of os.path is to help writing portable code. So passing an os.specific path componant is somewhat counter productive !-) (s

Re: Python shell on mac os x

2007-03-15 Thread Greg Donald
On 15 Mar 2007 14:56:13 -0700, Bert Heymans <[EMAIL PROTECTED]> wrote: > >>> ^[OA^[OC^[OD Is your python built with readline support? Also, you might check out iPython. -- Greg Donald http://destiney.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: command line arguments using subprocess

2007-03-15 Thread Gabriel Genellina
En Wed, 14 Mar 2007 16:51:04 -0300, Jim <[EMAIL PROTECTED]> escribió: > I'm trying to use subprocess to drive a Perl script. I'm having some > trouble getting it to spot the command line arguments. Basically, if > I call subprocess(args).wait() where args has a second item, I can't > convince th

Python shell on mac os x

2007-03-15 Thread Bert Heymans
Hi! I'm using iTerm on the mac the keymapping isn't right. On Linux and Windows it's really nice to be able to hit up to get the previous command. Does anyone know a way to get the Pyhton shell to work like on other systems, I always get this when I hit the direction keys: >>> ^[OA^[OC^[OD I've

Re: Using wildcards with Popen in the Subprocess module

2007-03-15 Thread William Hudspeth
Hello Mike, Thanks for responding. I need to pass multiple filenames to an executable. The filenames are similar to one another, but differ only slightly, hence the use of the wildcard. The executable works well from the command line if I pass in a wildcard filename, but Popen can't expand the wil

Re: most complete xml package for Python?

2007-03-15 Thread Paul Boddie
Diez B. Roggisch wrote: > metaperl schrieb: > > > > Well, I'm not a troll. And I am now even less impressed with > > ElementTree. It does not preserve the document but reforms it in > > certain cases. > > > > > > > > gets rewritten as > > > > > > > > which leads to problems when embedding Dojo Ri

Re: New Chess Module

2007-03-15 Thread shatranjchess
On Mar 15, 4:46 pm, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > written in Python, it's not blazingly fast...but Kasparov > > doesn't even look at 2k nodes per second, does he? ;-) > > Wow, cool. Out of curiosity how many nodes per second does it look > at? depend

Re: dict.items() vs dict.iteritems and similar questions

2007-03-15 Thread Duncan Booth
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, skip wrote: > >> Are you sure? There's no guarantee that an iterator will terminate: >> >> len(list(itertools.cycle(range(10 > > You have infinite memory? ;-) Strangely, Skip's example is exactly the one I

Re: Tkinter menu toplevel or frame

2007-03-15 Thread Matimus
> Please tell me is here anything that I should change. The way you have written it, master _must_ be a Toplevel object. So, maybe parent is the correct name, but it doesn't really matter. As a side note, there is no reason for this class to inherit Frame. Aside from packing and sizing the frame,

Re: problem with str()

2007-03-15 Thread 7stud
Sheesh! You would think that after looking at every inch of the code for way too many hours, at some point that would have poked me in the eye. Thanks all. -- http://mail.python.org/mailman/listinfo/python-list

Re: New Chess Module

2007-03-15 Thread Paul Rubin
[EMAIL PROTECTED] writes: > written in Python, it's not blazingly fast...but Kasparov > doesn't even look at 2k nodes per second, does he? ;-) Wow, cool. Out of curiosity how many nodes per second does it look at? -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with str()

2007-03-15 Thread Terry Reedy
"7stud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |I can't get the str() method to work in the following code(the last | line produces an error): If you 'print str' here | methodList = [str for str in names if callable(getattr(obj, str))] and again here, you will see the prob

Re: problem with str()

2007-03-15 Thread kyosohma
On Mar 15, 2:49 pm, "7stud" <[EMAIL PROTECTED]> wrote: > I can't get the str() method to work in the following code(the last > line produces an error): > > > class test: > """class test""" > def __init__(self): > """I am init func!""" > s

Re: problem with str()

2007-03-15 Thread Larry Bates
7stud wrote: > I can't get the str() method to work in the following code(the last > line produces an error): > > > class test: > """class test""" > def __init__(self): > """I am init func!""" > self.num = 10 > self.num2

Re: problem with str()

2007-03-15 Thread Matimus
Don't use built-ins as variable names. Your code will work if you change this: > methodList = [str for str in names if callable(getattr(obj, str))] to this: > methodList = [s for s in names if callable(getattr(obj, s))] -- http://mail.python.org/mailman/listinfo/python-list

Re: Importing WMI in a child Thread throws an error

2007-03-15 Thread Tim Golden
>> If you want to post some specific code examples, I'm >> happy to talk you through possible optimisations. >> >> TJG > > Sorry I didn't reply right away. Here's the straight WMI code I'm > using: > > c = wmi.WMI() > for i in c.Win32_ComputerSystem(): > mem = int(i.TotalPhysicalMemor

Re: merits of Lisp vs Python

2007-03-15 Thread John J. Lee
Jorge Godoy <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] (John J. Lee) writes: > > > John Nagle <[EMAIL PROTECTED]> writes: > > > >> John J. Lee wrote: > >> > "Graham Dumpleton" <[EMAIL PROTECTED]> writes: > >> > > >> >>On Mar 11, 12:31 pm, [EMAIL PROTECTED] (John J. Lee) wrote: > >> > >> > I

Re: Circular Class Logic

2007-03-15 Thread Gabriel Genellina
En Thu, 15 Mar 2007 09:01:07 -0300, <[EMAIL PROTECTED]> escribió: > I got it to work, but I had to add a check to see if the class > variable had been set.. > class Foo: > baz = None > def __init__(self): > if Foo.baz == None: > Foo.baz = True > initBaz() This is a different

Re: Importing WMI in a child Thread throws an error

2007-03-15 Thread kyosohma
On Feb 28, 3:08 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Feb 27, 3:32 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >>> The problem I have is that since I import WMI, it takes a long time > >>> and we have users complaining about it. So

python-list@python.org

2007-03-15 Thread [EMAIL PROTECTED]
On Jan 29, 7:12 pm, "Pappy" <[EMAIL PROTECTED]> wrote: > SHORT VERSION:PythonFile B changes sys.stdout to a file so all 'prints' are > written > to the file. Pythonfile A launchespythonfile B with os.popen("./B > 2>&^1 >dev/null &"). PythonB's output disappears into never-never > land. > > LONG

New Chess Module

2007-03-15 Thread shatranjchess
I'm releasing a new python chess module called shatranj. You can get it from www.employees.org/~stannous/shatranj until I move the project to sourceforge or some other place. It's a text based (bitboard) chess engine that implements an alphabeta search with iterative deepening. It also has a small

Re: os.path.isfile with *.tar.gz

2007-03-15 Thread Tim Golden
Boudreau, Emile wrote: > Hello All, > I'm new to Python and it looks like people that post here do get > a good answer back so I figured I'd try my luck. > > I'm trying to check a directory to see if there is a file that has the > name "startOfString" + some version number + "inst.tar.gz

Re: os.path.isfile with *.tar.gz

2007-03-15 Thread Steve Holden
Boudreau, Emile wrote: > Hello All, > I'm new to Python and it looks like people that post here do get > a good answer back so I figured I'd try my luck. > > I'm trying to check a directory to see if there is a file that has the > name "startOfString" + some version number + "inst.tar.gz

problem with str()

2007-03-15 Thread 7stud
I can't get the str() method to work in the following code(the last line produces an error): class test: """class test""" def __init__(self): """I am init func!""" self.num = 10 self.num2 = 20 def someFunc(self):

Re: Using wildcards with Popen in the Subprocess module

2007-03-15 Thread Fabio FZero
You could use glob and expand the resulting list to astring manually, but you have to make sure the command accepts the "command file1 file2 file3..." format. FZero On Mar 15, 4:04 pm, William Hudspeth <[EMAIL PROTECTED]> wrote: > Hello, > > I am needing to pass an argument to the Popen function

Re: Using wildcards with Popen in the Subprocess module

2007-03-15 Thread kyosohma
On Mar 15, 2:04 pm, William Hudspeth <[EMAIL PROTECTED]> wrote: > Hello, > > I am needing to pass an argument to the Popen function of the Subprocess > module that includes a wildcard in the filename. It seems that Popen is > not able to expand wildcards, and treats a filename that includes a > wil

Re: Circular Class Logic

2007-03-15 Thread Paul McGuire
On Mar 15, 1:55 pm, [EMAIL PROTECTED] wrote: > > class Disk(Folder): > > def __init__(self,driveLetter): > > super(Disk,self).__init__(driveLetter+":/") > > What is going on there? Is it just explicitly calling the super's > init function? What is going on is that Disk is being initia

os.path.isfile with *.tar.gz

2007-03-15 Thread Boudreau, Emile
Hello All, I'm new to Python and it looks like people that post here do get a good answer back so I figured I'd try my luck. I'm trying to check a directory to see if there is a file that has the name "startOfString" + some version number + "inst.tar.gz" (component-8.3.16-inst.tar.gz) The

Re: right-format of integer output as text

2007-03-15 Thread dmitrey
Thank you Marc, it is exactly the same I asked for. D. -- http://mail.python.org/mailman/listinfo/python-list

Re: Circular Class Logic

2007-03-15 Thread half . italian
> Just initialize Folder at module level - see below. > -- Paul > > class Disk(Folder): > def __init__(self,driveLetter): > super(Disk,self).__init__(driveLetter+":/") What is going on there? Is it just explicitly calling the super's init function? How is that really different from t

Re: right-format of integer output as text

2007-03-15 Thread dmitrey
There are some errors occured in displaing previous message, I meant all right borders are the same, + some number of spaces before integer numbers, according to the number of digits D. -- http://mail.python.org/mailman/listinfo/python-list

Re: right-format of integer output as text

2007-03-15 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, dmitrey wrote: > how can I implement this one in the simpliest way? > Thank you in advance, In [45]: '%10d' % 1 Out[45]: ' 1' In [46]: '%10d' % 42 Out[46]: '42' In [47]: '%10d' % 1 Out[47]: ' 1' Ciao, Marc 'BlackJack' Rintsch -- http

right-format of integer output as text

2007-03-15 Thread dmitrey
hi all, I need printing the following: 1 2 3 ... 9 10 ... 99 100 ... 999 1000 1001 ... how can I implement this one in the simpliest way? Thank you in advance, D. -- http://mail.python.org/mailman/listinfo/python-list

right-format of integer output as text

2007-03-15 Thread dmitrey
hi all, I need printing the following: 1 2 3 ... 9 10 ... 99 100 ... 999 1000 1001 ... how can I implement this one in the simpliest way? Thank you in advance, D. -- http://mail.python.org/mailman/listinfo/python-list

Re: dict.items() vs dict.iteritems and similar questions

2007-03-15 Thread bearophileHUGS
Alex Martelli: > Right. However, "return sum(1 for _ in iterator)" may be a handier way > to express the same desctructive semantics as the last 4 lines here. With the speed tests I have done my version did come out as the faster one. Bye, bearophile -- http://mail.python.org/mailman/listinfo

Tkinter menu toplevel or frame

2007-03-15 Thread Gigs_
what is the best way to write tkinter menus? As toplevels or as frame with Menubutton? im doing like this class MyWidget(Frame): def __init__(self, master=None):""" should this master be parent? Because my first tought was that this is toplevel master than i found that its not"""

Re: Box plot in Python

2007-03-15 Thread Sebastian Bassi
On 3/15/07, Rob Clewley <[EMAIL PROTECTED]> wrote: > Matplotlib supports boxplots in a very straightforward fashion and is > reasonably documented (just google it!) I actually just submitted a > patch for extra boxplot features in matplotlib, which you can find on > the sourceforge patch tracker.

Re: ANN: ActivePython 2.5.0.0 is now available

2007-03-15 Thread Thomas Heller
Trent Mick schrieb: > [EMAIL PROTECTED] wrote: >> >> is ctypes supported on ActivePython for Windows x64? >> > > No. > http://aspn.activestate.com/ASPN/docs/ActivePython/2.5/whatsincluded.html > > My understanding (from http://www.python.org/sf/1545507) is that ctypes isn't > yet ported to Win

Re: dict.items() vs dict.iteritems and similar questions

2007-03-15 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, skip wrote: > Are you sure? There's no guarantee that an iterator will terminate: > > len(list(itertools.cycle(range(10 You have infinite memory? ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: logging and wx.Timer

2007-03-15 Thread hg
hg wrote: > Jordan wrote: > >> On Mar 14, 1:52 am, hg <[EMAIL PROTECTED]> wrote: >>> Hi, >>> >>> I read that logging was thread safe ... but can I use it under a GUI >>> timer ? >>> >>> Thanks, >>> >>> hg >> >> That was barely enough information to be worthy of a reply. Need more >> than that.

Re: most complete xml package for Python?

2007-03-15 Thread Diez B. Roggisch
metaperl schrieb: > On Mar 14, 5:34 pm, "John Machin" <[EMAIL PROTECTED]> wrote: > > >> Given keywords like "Amara" and "Elementtree" and past history, it >> looked to me like a troll of one kind trying to incite a troll of >> another kind to pop out from under the bridge and chew on his >> ankle

Re: looking for a simple crypto library

2007-03-15 Thread hg
Paul Rubin wrote: > tlslite cool ! -- http://mail.python.org/mailman/listinfo/python-list

Using wildcards with Popen in the Subprocess module

2007-03-15 Thread William Hudspeth
Hello, I am needing to pass an argument to the Popen function of the Subprocess module that includes a wildcard in the filename. It seems that Popen is not able to expand wildcards, and treats a filename that includes a wildcard as a literal. EX. var1="/path_to_files/filnames*.doc" result=Popen

Re: dict.items() vs dict.iteritems and similar questions

2007-03-15 Thread skip
Duncan> I think I'd prefer the barbaric: Duncan>return len(list(iterator)) Duncan> since at least it is guaranteed to terminate. Are you sure? There's no guarantee that an iterator will terminate: len(list(itertools.cycle(range(10 Skip -- http://mail.python.org/mailm

Re: Passing a FILE* from Python into a MinGW/SWIG module

2007-03-15 Thread Tommy Nordgren
On 14 mar 2007, at 11.57, John Pye wrote: > Hi all > > I understand that I can't hope to pass a FILE* from the Windows > version of Python into a SWIG module that I've built using MinGW > gcc/g+ > +, because apparently the FILE* structure are different and > incompatible. > > Is there an offici

Re: Pickle Problem

2007-03-15 Thread tonyr1988
On Mar 15, 10:38 am, Gary Herron <[EMAIL PROTECTED]> wrote: > tonyr1988 wrote: > > I'm a complete python n00b writing my first program (or attempting to, > > anyway). I'm trying to make the transition from Java, so if you could > > help me, it would be greatly appreciated. Here's the code I'm stuck

Re: Passing a FILE* from Python into a MinGW/SWIG module

2007-03-15 Thread Ross Ridge
John Pye <[EMAIL PROTECTED]> wrote: >Is there an official workaround for this? Presumably I need to >implement a mingw-compatible version of all the 'file' class in >Python, eg I'm not familiar with SWIG, but why not pass Python's own file class? Method calls on Python's file class will be dispatc

  1   2   >