[Python-ideas] parameter omit

Jim Jewett jimjjewett at gmail.com
Sat May 12 21:10:00 CEST 2007


On 5/12/07, Aaron Brady <castironpi at comcast.net> wrote:
> Can we do:

>         sentinel=object()
>         def f(val='utf-8'):
>                 if val is sentinel:

Sure, but then people have to import sentinel before using it to call
your function.

> ?  How common are non-None default values?

Pretty common.  They are usually (but not always) a zero of some sort
(0, "", {}, []) which *could* be done with the None and type
annotations in Py3.

-jJ



More information about the Python-ideas mailing list