test for None
Ben Finney
bignose+hates-spam at benfinney.id.au
Tue Apr 18 21:53:01 EDT 2006
"BartlebyScrivener" <rpdooling at gmail.com> writes:
> How do you test for a function that returns nothing,
A function returns a single value (which may be a container for other
values). By default, with no 'return' statement, it returns the None
object.
What is it you're trying to do?
> and why doesn't
> this work? Shouldn't X have to be either None or not?
Yes.
> >>>x = None
Assigns the name 'x' to the None object.
> >>> for x in []:
Iterates over an empty list, which results in zero iterations;
i.e. does nothing.
Have you followed the tutorial through, running and understanding each
example, to get the basics of Python covered?
<URL:http://docs.python.org/tut/>
--
\ "I was trying to daydream, but my mind kept wandering." -- |
`\ Steven Wright |
_o__) |
Ben Finney
More information about the Python-list
mailing list