Is there a simpler way to modify all arguments in a function before using the arguments?

Chris Angelico rosuav at gmail.com
Sat Nov 10 10:19:11 CET 2012


On Sat, Nov 10, 2012 at 3:05 PM, Paul Rubin <no.email at nospam.invalid> wrote:
> Chris Angelico <rosuav at gmail.com> writes:
>> Contrived example:
>> def send_email(from, to, subj, body, whatever, other, headers, you, like):
>
> That should be a dictionary with the header names as indexes.  In fact
> there are already some email handling modules in the stdlib that
> represent headers that way.

That's also plausible, but keyword arguments do make sense. And this
was a top-of-the-head contrived example; I'm sure there are plenty of
good use-cases.

ChrisA


More information about the Python-list mailing list