Re: [Tutor] python shell not working like it used to

2007-02-26 Thread Alan Gauld
"Jeff Peery" <[EMAIL PROTECTED]> wrote > def __init__(self, other): >d['this'] = other.this > > "other" here is the dictionary I pass in (I think), > so it's for some reason looking for some attribute in > my dictionary called 'this'. other is whatever you pass in. The code e

Re: [Tutor] wav audio playback

2007-02-26 Thread Alan Gauld
"Isaac" <[EMAIL PROTECTED]> wrote > """ > RuntimeWarning: Python C API version mismatch for module _portaudio: > This > Python has API version 1013, module _portaudio has version 1012. > import _portaudio as pa """ > > It does play sound but how can I get rid of this error? You need an update

Re: [Tutor] miniwiki 1.3 BETA bugs

2007-02-26 Thread Barnaby Scott
Kirk Z Bailey wrote: > RE leaves me totally confuzzzeddded. Yep, so confuised I'm having > trouble spelling it. Sp this one line will replace both words and give a > reliable result? > > Barnaby Scott wrote: > [snip] >> No idea if it has anything to do with your problem, but it struck me >> tha

Re: [Tutor] dictionaries and memory handling

2007-02-26 Thread Arild B. Næss
Thanks a lot for your replies. Using a dbm seems to be a very good solution in some cases. But most of my dictionaries are nested, and since both keys and values in the dbm 'dictionaries' have to be strings, I can't immediately see how I could get it to work. A bit more detail: I deal wi

Re: [Tutor] dictionaries and memory handling

2007-02-26 Thread Arild B. Næss
Thanks a lot for your replies. Using a dbm seems to be a very good solution in some cases. But most of my dictionaries are nested, and since both keys and values in the dbm 'dictionaries' have to be strings, I can't immediately see how I could get it to work. A bit more detail: I deal wi

Re: [Tutor] Running an exe from Python

2007-02-26 Thread Nagendra Singh
Thanks a lot for all the suggestions. I used the function subprocess.call ( 'c:\abc.exe c:\data\file1'), but as before the command window opens and closes very fast a value of 1 is displayed. How do I see the results?? I am sorry if I sound dumb. Singh On 2/23/07, Alan Gauld <[EMAIL PROTECTED]

Re: [Tutor] Running an exe from Python

2007-02-26 Thread Dan Klose
On 2/26/07, Nagendra Singh <[EMAIL PROTECTED]> wrote: Thanks a lot for all the suggestions. I used the function subprocess.call( 'c:\abc.exe c:\data\file1'), but as before the command window opens and closes very fast a value of 1 is displayed. How do I see the results?? I am sorry if I sound

Re: [Tutor] Embedding Python

2007-02-26 Thread Dave Kuhlman
On Sun, Feb 25, 2007 at 01:35:52PM -0800, Dj Gilcrease wrote: > On 2/25/07, Dave Kuhlman <[EMAIL PROTECTED]> wrote: > > If you have not already, you will want to look at SWIG > > (http://www.swig.org/). SWIG will generate C or C++ code from a > > header file containing structs and classes and func

Re: [Tutor] Running an exe from Python

2007-02-26 Thread Alan Gauld
"Nagendra Singh" <[EMAIL PROTECTED]> wrote > Thanks a lot for all the suggestions. I used the function > subprocess.call ( 'c:\abc.exe c:\data\file1'), but as before > the command window opens and closes very fast > a value of 1 is displayed. How do I see the results?? The result is 1 which ind

[Tutor] Trouble creating DB2 drivers

2007-02-26 Thread taserian
I'm trying to build the DB2 drivers I downloaded from http://sourceforge.net/projects/pydb2 but I'm getting an error message when I try installing them (after doing "python setup.py install"): Your DB2 root is: C:\Program Files\SQLLIB\ WARNING: it seems that you did not install 'Application Devel

Re: [Tutor] miniwiki 1.3 BETA bugs

2007-02-26 Thread Kirk Bailey
ok, when I have some time to do some coding I will work on trying this. AS is, it is pretty cleaned up, b utg making it less hairy and more definate in it's execution is a Great Good Thing(tm). If the project intrests you I will sip up the current version and leave it on my domain so you can fi

[Tutor] Another list comprehension question

2007-02-26 Thread Smith, Jeff
I'm probably missing something simple here but is there anyway to accomplish the following with a list comprehension? def get_clists(): return [1, 2, 3] def get_clist(num): if num == 1: return ['a', 'b', 'c'] if num == 2: return ['x', 'y', 'z'] if num == 3:

Re: [Tutor] Another list comprehension question

2007-02-26 Thread Bob Gailer
Smith, Jeff wrote: > I'm probably missing something simple here but is there anyway to > accomplish the following with a list comprehension? > Each element created by a comprehension corresponds to an element returned by the for (if) clause. So we have to find a way for the for clause to retur

Re: [Tutor] Another list comprehension question

2007-02-26 Thread John Fouhy
Hi Jeff, On 27/02/07, Smith, Jeff <[EMAIL PROTECTED]> wrote: > I'm probably missing something simple here but is there anyway to > accomplish the following with a list comprehension? > > def get_clists(): > return [1, 2, 3] > > def get_clist(num): > if num == 1: > return ['a', 'b',

Re: [Tutor] python shell not working like it used to

2007-02-26 Thread Jeff Peery
well the __init__() funciton is not my code, it is in: C:\Python24\Lib\site-packages\wx-2.6-msw-unicode\wx\py\shell.py as I mentioned I upgraded wxpython... maybe I should email there... anyhow I just want to use my dictionary in the shell, but I'm not sure what the attribute 'this' is... it

Re: [Tutor] Another list comprehension question

2007-02-26 Thread Bob Gailer
John Fouhy wrote: [snip] > > Or [x for k in get_clists() for x in get_clist(k)] using your original > structure. > Well I learned something! -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/t

[Tutor] isinstance -> instance

2007-02-26 Thread Bernard Lebel
Hello, Following the guidelines here, at the bottom of the page: http://www.python.org/dev/peps/pep-0008/ I'm using isinstance() to test the type of some data. Now the thing is that, what is the name to use for a class instance? For example, say I run this: class A: def __init__( self ):

[Tutor] FW: isinstance -> instance

2007-02-26 Thread Mike Hansen
Oops...I replied instead of replied all. > -Original Message- > From: Mike Hansen > Sent: Monday, February 26, 2007 2:43 PM > To: 'Bernard Lebel' > Subject: RE: [Tutor] isinstance -> instance > > > > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECT

Re: [Tutor] FW: isinstance -> instance

2007-02-26 Thread Bernard Lebel
That's fine, but that tells me that 'a' is an instance of 'A'. It doesn't, however, tell me if 'a' is an instance or the actual class object. Thanks Bernard On 2/26/07, Mike Hansen <[EMAIL PROTECTED]> wrote: > Oops...I replied instead of replied all. > > > -Original Message- > > From:

Re: [Tutor] FW: isinstance -> instance

2007-02-26 Thread Jerry Hill
On 2/26/07, Bernard Lebel <[EMAIL PROTECTED]> wrote: > That's fine, but that tells me that 'a' is an instance of 'A'. > It doesn't, however, tell me if 'a' is an instance or the actual class object. It doesn't? >>> class A: pass >>> a = A() >>> isinstance(a, A) True >>> isinstance(A, A)

Re: [Tutor] isinstance -> instance

2007-02-26 Thread Alan Gauld
"Bernard Lebel" <[EMAIL PROTECTED]> wrote > class A: >def __init__( self ): >self.a = 'a' > > a = A() > > print type( a ) > > Outputs: > So use types.Instancetype import types as t >>> class A: pass ... >>> a = A() >>> type(a) >>> type(A) >>> type(a) == t.InstanceType True >>>

Re: [Tutor] FW: isinstance -> instance

2007-02-26 Thread Kent Johnson
Bernard Lebel wrote: > That's fine, but that tells me that 'a' is an instance of 'A'. > It doesn't, however, tell me if 'a' is an instance or the actual class object. I'm not sure what you are trying to do. In [1]: class A: pass ...: In [2]: a=A() In [3]: isinstance(a, A) Out[3]: True In [4]:

Re: [Tutor] FW: isinstance -> instance

2007-02-26 Thread Kent Johnson
Jerry Hill wrote: > I believe you can check for an instance of a new-style class > with: > isinstance(a, object) I'm not sure if that will ever fail. Given values from my previous post, I get: In [16]: isinstance(a, object) Out[16]: True In [17]: isinstance(A, object) Out[17]: True In [18]: isins

Re: [Tutor] FW: isinstance -> instance

2007-02-26 Thread Bernard Lebel
Okay. right now I'm using types.InstanceType approach. To elaborate on the context of my question, I have this module whose only job is to test an object against a large array of types. The thing is that I never know in advance what is going to be the data, and it could be just about anything

Re: [Tutor] Group sequence pairwise

2007-02-26 Thread Justin Ezequiel
>>> a = list('asdfg') >>> map(None, a[::2], a[1::2]) [('a', 's'), ('d', 'f'), ('g', None)] >>> a = list('asdfgh') >>> map(None, a[::2], a[1::2]) [('a', 's'), ('d', 'f'), ('g', 'h')] >>> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailma

[Tutor] Question about profile.run() and decorators

2007-02-26 Thread Thane.Frivold
To whom it may concern, I was directed to this forum... I searched for 'decorator profile' in the Python tutorial archives, and had no hits, so I hope this is not a lame question. Is there a way to construct a string version (suitable to pass into profile.run()) from what is avail

Re: [Tutor] Question about profile.run() and decorators

2007-02-26 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Is there a way to construct a string version (suitable to pass > into profile.run()) from what is available inside a decorator function? > I realize that what I am trying to do could probably be done otherwise, > but this arose out of questions and problems possed