Hi PyMOLers,

I am trying to write a python script that will allow a user to provide an 
unlimited number of positional arguments for a function.  I am use to the 
following scheme for defining a function and its arguments:

def some_function ( x, y, z, file="false"):

#DO SOMETHING

return

Where x, y, and z are required arguments and "file=false" is an optional 
argument.  I came across the following page pertaining to Python:

http://www.linuxtopia.org/online_books/programming_books/python_programming/python_ch15s09.html

See "Unlimited Number of Positional Arguments Values"

There it explains that one could use the following syntax:

def some_function ( *args):

    print arg[0]

return

Now, when put this in a script and call the function in PyMOL it spits out the 
following error:

Traceback (most recent call last):
  File "/pymol/./modules/pymol/parser.py", line 254, in parse
    self.result=apply(layer.kw[0],layer.args,layer.kw_args)
TypeError: some_function() got an unexpected keyword argument '_self'

Is the "*args" method simply not possible in PyMOL?  I tried using "**args" 
which worked nicely for keyword arguments.

Any help would be greatly appreciated.  Thank you for your time.

Sean

_________________________________________________________________
Stay on top of things, check email from other accounts!
http://go.microsoft.com/?linkid=9671355
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to