[Python-ideas] parameter omit

Scott Dial scott+python-ideas at scottdial.com
Thu May 10 00:15:42 CEST 2007


Aaron Brady wrote:
> You can almost do,
> 	b=f.func_defaults[1],
> but you still have to know where the defaults start.  Very small what I'm
> missing.
> 
> -----Original Message-----
> From: python-ideas-bounces at python.org
> [mailto:python-ideas-bounces at python.org] On Behalf Of Aaron Brady
> Sent: Wednesday, May 09, 2007 4:50 PM
> To: 'Josiah Carlson'; python-ideas at python.org
> Subject: Re: [Python-ideas] parameter omit
> 
> No, still not uniform.  Cases might be rare, even syntactic sugar maybe.
> if something huge:
> 	b=<def>
> more huge
> if something else:
> 	b=mything
> still more
> f(a,b,c).
> 

I've never wanted to do this in my life..

args = {}
if foo:
     args['b'] = b
if bar:
     args['c'] = c
f(a, **kwargs)

-Scott

-- 
Scott Dial
scott at scottdial.com
scodial at cs.indiana.edu



More information about the Python-ideas mailing list