Then name it something else. I tend to chose "this" because it is a
meaningless name that would not tend to be used for anything else. I would
have used "self", except that that tends to be used inside classes. My
inspiration for coming up with this is to make modules a little more like
classes. I suppose you wouldn't like me to post my own (somewhat buggy)
module that allows you to import modules as new type classes?

On 4/5/07, Steve Holden <[EMAIL PROTECTED]> wrote:

Collin Stocks wrote:
> As for me, I find this problem annoying, but easy to solve. My solution
is:
>
>  >>> this=__import__(__name__)
>
> To  set global variable spam to 4, I say:
>
>  >>> this.spam=4
>
> This always works, and is much more convenient than:
>
>  >>> global spam
>  >>> spam=4
>
> and then worry about local variables also named spam.
>
That's truly horrible. And what if you have a local variable called
"this"?

regards
  Steve
--
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb     http://del.icio.us/steve.holden
Recent Ramblings       http://holdenweb.blogspot.com

--
http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to