[Tutor] Is "var = None" in Python equivalent to "Set var

Tony Cappellini cappy2112 at gmail.com
Mon Jun 30 00:53:05 CEST 2008


is this not your reply?

"the reason why i ask is because it's not standard practice i see
people doing this with Python, so i'm trying to get a better
understanding of what you're trying to do.

-- wesley"

> *exactly* why, other than most of the time, people let objects go
> out-of-scope and are reclaimed "naturally" or more rarely, i see
> people calling del on an object to remove it from the namespace
> explicitly. now, what i *do* see a lot is where a variable is
> originally initialized to None.
> > Since when is setting anything to None an outdated practice?
> >>not sure what you mean here, but i never said anything like this in my
> >>reply, nor was there any reference to anything being outdated.

The original author asked about the similarity between VB setting an object
to Nothing, and Python  vars being set to None

Your answer implies that this is an outdate practice (or not preferred) in

> > Does this mean checking an object to None is also outdated?
> >>again, i'm not sure what you mean here as my reply never inferred
> >>this. although i am curious... how *do* you check an object to None?

> This was my own question, If you don't set an object to None- explicitly,
> then to you ever check to see if an object is None?

> >>you mean the variable. the only difference between this and using del

>>again, you said "var" but i'm assuming you mean object.

The original post referred to var, but a var is aon object- so I wasn't
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080629/7882a024/attachment.htm>

More information about the Tutor mailing list