Over the years, I've occasionally used this idiom: NULLARGUMENT = () def someFunctionOrMethod (argument = NULLARGUMENT ): if argument is NULLARGUMENT: doSomething() else: doSomethingElse() That is, I was attempting to distinguish between a call where argument is passed a NULL tuple and a call where argument is passed nothing at all. When I was working on unit tests for my current piece of code, however, I discovered that this no longer works (Python 1.5.2). No idea for how long it hasn't worked. Now, of course, I could have used: class NULL: pass NULLARGUMENT = NULL() # a particular instance or NULLARGUMENT = NULL # use the class itself or NULLARGUMENT = [] or I could've used an approach where I used *arguments and **namedarguments to determine whether the argument was really passed. There are all sorts of other ways to do this. Apparently optimisation has come to the tuples of the world, so using tuple identities is now a no-no. All those who have used null-tuple identities should now go and fix their code. Mike __________________________________ Mike C. Fletcher Designer, VR Plumber http://members.home.com/mcfletch
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