Re: [Tutor] exit handler for C extension module

2010-01-18 Thread Shuying Wang
I found what I was after, right after I posted to this list. It's Py_AtExit. I'm accessing an old, unsupported database using it's C API. I've tried using Cython but found it hard to get my head around and I'm finding it somewhat easier to just write by hand. On Mon, Jan 18, 2010 at 6:40 PM, Stefa

[Tutor] exit handler for C extension module

2010-01-17 Thread Shuying Wang
Hi, What would be an atexit equivalent for a C extension module? When my extension module is unloaded, I would like some clean up functions to be called from an external c library. I've had a look at the C extension guide but I can't find anything like that, Thanks in advance, .S

[Tutor] self

2006-02-12 Thread Shuying Wang
Hi, I'm having problems understanding some code I came across: class Singleton: __single = None def __init__( self ): if Singleton.__single: raise Singleton.__single Singleton.__single = self What does passing self to Singleton.__single do? --Sh

Re: [Tutor] putting instance variables into a dict

2006-01-30 Thread Shuying Wang
Hi, That's more or less what I want. Thanks! Now I just need to figure out metaclasses and poke around python's innards. :D --Shuying On 1/30/06, Danny Yoo <[EMAIL PROTECTED]> wrote: > It's an somewhat low-level detail that the attributes of a class instance > can be

[Tutor] putting instance variables into a dict

2006-01-29 Thread Shuying Wang
Hi, So I've got a class X with instance variables a, b, c. Is there any way of creating a dictionary of these instance variables besides the no-brainer way of doing dictionary = {'a' : X.a, 'b' : X.b, 'c' : X.c} ? --Shuying _

Re: [Tutor] I'm puzzled

2006-01-22 Thread Shuying Wang
nd a[1:].isdigit(): to : elif len(a) > 1 and a[0] == '-' and a[1:].isdigit(): I expect you'll get what you want. --Shuying On 1/23/06, Vincent Zee <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm puzzled (:-)) > > Why will this little program crash when you

Re: [Tutor] a class knowing its self

2006-01-18 Thread Shuying Wang
Ben, If you change example #b to: for s in SkillNames: skill = Skill() skill.setName(s) print skill.getName() You will find that the results are the same as #a. In your #b example, you are giving setName() the skill instance instead of the string you intended. --Shuying On 1/19/06

Re: [Tutor] setuptools question

2006-01-16 Thread Shuying
I think I tried python2.4 /usr/bin/easy_install -U setuptools and directly the #! line in easy_install to use python2.4. On 1/16/06, Liam Clarke <[EMAIL PROTECTED]> wrote: > How were you calling easy_install? > > On 1/16/06, Shuying <[EMAIL PROTECTED]> wrote: > > Hi, &

[Tutor] setuptools question

2006-01-15 Thread Shuying
g_resources.VersionConflict: (setuptools 0.6a5 (/usr/lib/python2.4/site-packages/setuptools-0.6a5-py2.4.egg), Requirement.parse('setuptools==0.6a9')) and I'm not sure what's the best way to fix it. Suggestions please! Thanks, Shuying ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] CGIXMLRPCRequestHandler doesn't actually work, does it?

2005-06-23 Thread Shuying Wang
I'm not sure what you're trying to do. But I run cgi scripts and make xmlrpc requests with xmlrpclib with a connection with xmlrpclib.Server(server_uri), though I'm only doing this client side. I'm not running the server as cgi. On 6/23/05, Ron Phillips <[EMAIL PROTECTED]> wrote: > > I believe I

[Tutor] not invoking the shell from python

2005-06-21 Thread Shuying Wang
status='%s' ''' % (data['requestor'],data['owner'],data['queue'], re.sub(r'\"',r'\\"',data['subject']), re.sub(r'\"',r'\\"', data['body']), data['status']) thanks in advance, Shuying ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] calling perl from python code

2005-06-20 Thread Shuying Wang
Hi, Can anyone recommend a library that will let me call perl functions from python? I have a python dictionary that I would like to convert to a perl hash for some function. cheers, Shuying ___ Tutor maillist - Tutor@python.org http