why * is not like unquote (scheme)
oren-py-l at hishome.net
Thu Mar 20 12:50:43 CET 2003
On Thu, Mar 20, 2003 at 01:26:07PM +0200, Amir Hadar wrote:
> I'me tring to create a factory function that create a class as follow:
> def CreatePreviewFrame(*addins):
> class tmp(cPreviewFrame,*addins):
> return tmp
> I checked a simpler case:
> and this is also syntax error.
> but I can path parameters to a function as follow:
> def f(a,b):
> print a,b
> l = ("a","b")
> So why doesn't it work in all cases?
The * is specific to calls. It does not apply to other places in the
systax where a comma-separated list is acceptable.
You can do what you want using the exec statement or by directly
creating the class object with new.classobj() instead of using the
More information about the Python-list