[Zope] brain hurts regarding dynamic fcn args in Python

Chris McDonough chrism@digicool.com
Mon, 19 Jun 2000 17:07:03 -0400


Oops, I'm not quite right about this.  This FAQ explains it better...

http://www.python.org/doc/FAQ.html#4.16

> -----Original Message-----
> From: chrism@digicool.com [mailto:chrism@digicool.com]
> Sent: Monday, June 19, 2000 4:51 PM
> To: zope@zope.org
> Subject: RE: [Zope] brain hurts regarding dynamic fcn args in Python
> 
> 
> > Is there a (straightforward?) way to dynamically compose function
> > argument lists?  For example, in C, you can write"
> > 
> > f(arg1, arg2, (conditional expression)?(val for TRUE 
> > state):(val for FALSE state)).
> 
> This can be emulated in Python by the boolean logic:
> 
> ( ({conditional expression}) and {TRUE val} ) or {FALSE val}
> 
> e.g.
> 
> a = ( ( (x > 1) and "biggerthanone" ) or "smallerthanone" )
> 
> >>> x = 0
> >>> a = ( (x > 1) and "biggerthanone" ) or "smallerthanone"
> >>> a
> 'smallerthanone'
> 
> > 
> > Or  one can embed a fcn call within an argument list in order 
> > to supply a
> > needed function parameter.
> 
> 
> Hrm.. I *think* this will work as a function argment.  Sure.. why not?
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 
> 
> ---
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>