Any other Python flaws?

D-Man dsh8290 at rit.edu
Mon Jun 18 15:41:41 EDT 2001


On Mon, Jun 18, 2001 at 08:10:12PM +0100, Michael Hudson wrote:
| D-Man <dsh8290 at rit.edu> writes:
| 
| > On Fri, Jun 15, 2001 at 02:18:04PM -0500, Michael Chermside wrote:
| > | Oh well... at least people don't bump into this one much. And if you
| > | accidently clobber it, you can restore things with:
| > | 
| > | def __None():
| > |     pass
| > | None = __None()
| > 
| > Well, that doesn't work.  One of the key features of 'None' is that
| > there only ever exists a single instance.  This would create a new,
| > unique, instance bound to (a more local) 'None'.
| 
| No it wouldn't.  Try it!

<slaps forehead after looking much closer>

Yeah, he used 'def', not 'class'!

| I agree that what Michael posted doesn't really do what he wanted; but
| it doesn't do what you said, either.

It seems to, with some cursory tests in the interactive interpreter.
I would have to look at the source to see _how_ the function
implicitly returns 'None' to understand why it doesn't behave as
intended.

-D





More information about the Python-list mailing list