[Python-ideas] parameter omit

Aaron Brady castironpi at comcast.net
Sun May 13 00:21:22 CEST 2007



> -----Original Message-----
> From: Jim Jewett [mailto:jimjjewett at gmail.com]
> Sent: Saturday, May 12, 2007 2:10 PM
> To: Aaron Brady
> Cc: python-ideas at python.org
> Subject: Re: [Python-ideas] parameter omit
> 
> 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

I've gone through quite a few moods, attitudes, reading this.  If you do,
seek help; I am a miscreant by profession.

Ranging from audacity and awe, to indignance, I have found the newsgroup on
the whole to be reasonable yet stubborn.  Expect me to take the other side
soon.  Erratic, fickle, go for it.  Jewett's idea,

>         if defaulted val:

-is- very Pythonic, blending in much better than mine.

Mine isn't after all but I don't see why or how.  Too bad too; it's a beaut'
as ideas go.

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

Good.  Fine.  From constants import True, None, Sentinel.  I see in
contrast.

You know how many cigarettes I'd get for free if I saved all my C-Note
Camelbucks?

More later, if at all.




More information about the Python-ideas mailing list