Is there a better algorithm?

Lie Lie.1296 at gmail.com
Tue Jan 13 09:07:43 EST 2009


On Jan 3, 11:55 am, Kottiyath <n.kottiy... at gmail.com> wrote:
> On Jan 3, 2:38 am, mr <mario.rugg... at gmail.com> wrote:
>
<snip>
> It is a code to post some data to HTML server.
> Even though usually the POST values are of type(name, value), if file
> transfer is involved, then POST values change to (name, filename,
> value).
> My view was that since filename is a rare occurance and doesnt make
> sense in a usual POST, I had not kept it as a full 3 tuple.
> Since so many programmers (that too much more capable than me) are
> suggesting that it is code smell, I am reviewing my decision.

Is it possible to change (name, filename, value) into (name, value,
filename) instead?

In most cases optional arguments should be last. There are some very
exceptional case, where early optional argument might be better, like
python's range, which type signature is: [[start,] stop[, step]] (i.e.
with one argument, it is assigned to stop, instead of start)



More information about the Python-list mailing list