new to python - trouble calling a function from another function
Michael Torrie
torriem at gmail.com
Sat Aug 7 02:10:05 EDT 2010
On 08/05/2010 01:25 AM, Brandon McCombs wrote:
> How can that be? I don't get any errors when the script
> executes. Surely this isn't some limitation I'm encountering?
>
> <snipped code>
> yield (p.destination - self.currenteFloor) * TRAVELTIME, self
^^^^^^^^^
To be succinct, goUp() is apparently a generator function. "yield"
means the function needs to be iterated over; calling it just sets up
the generator and returns a generator object. So yeah your goUp() call
will appear (and actually does) do nothing at all.
More information about the Python-list
mailing list