The ** operator ambiguous?

Paul Boddie paul at boddie.org.uk
Tue Jul 17 01:28:19 CEST 2007


Robert Dailey wrote:
> I noticed that the ** operator is used as the power operator, however
> I've seen it used when passing variables into a function.

Others have already pointed out the relevant documentation. However,
this ambiguous usage of * and ** is one thing I don't recall appearing
on any of the "Python warts" lists - not that I spend too much time
following such matters. I imagine that * was initially chosen in order
to be similar to the way one may handle collections of values in C
function signatures (ie. using pointers), and that ** was merely a
convenient next step as opposed to being analogous to the "pointer to
pointer" notation from C. The same symbols are used in different ways
in C and C++, of course.

It's interesting to see a fresh interpretation of the notation,
though.

Paul




More information about the Python-list mailing list