"Mike C. Fletcher" <mcfletch at home.com> wrote in <mailman.987578846.15784.python-list at python.org>: > You want this kind of construct when creating "generic services" that > can process any object type (including None), so need to be able to > determine whether the object passed is, in fact, the value None, or > merely the absence of a value. > > So why not use the portable and safe way of finding out whether your function was called with a particular argument or not? def foo(**kw): validargs = { 'bar': None } validargs.update(kw) assert len(validargs)==1 if kw.has_key('bar'): print "Have bar" else: print "No bar" -- Duncan Booth duncan at dales.rmplc.co.uk int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3" "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4