"min( arg1, arg2, *args )" vs. "print( value, ... )"?

Peter J. Holzer hjp-python at hjp.at
Thu Apr 9 17:00:22 EDT 2020


On 2020-04-08 08:50:07 +0200, Luuk wrote:
> On 6-4-2020 22:57, Stefan Ram wrote:
> >    The documentation ("help" under CPython 3.9) for "min" reads
> >    (simplified):
> > 
> > min( arg1, arg2, *args )
> > 
> >    , for "print" it reads (simplified):
> > 
> > print( value, ... ).
> > 
> >    The caller can place an arbitrary number of arguments at the
> >    place of "value, ..." or of "*args", respectively.
> > 
> >    So, from the point of view of the caller: is there any
> >    difference between "args, ..." and "*args" when he reads
> >    it in the documentation?
> 
> `arg1, arg2, *args` is just a smart way to say you need at least 2 args.

min(arg1, arg2, *args) is Python syntax.

min(arg1, arg2, args, ...) isn't. It is kind of C-like, but not really.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20200409/ffb3699b/attachment.sig>


More information about the Python-list mailing list