Calling Python's Function, Retrieving the Feed Address
Now that we have the function defined, we can call it. If you try to use a function before it is defined, Python will throw a NameError. While C programming one declares the function ahead of time and define it later (commonly called [link url=http://cplus.about.com/od/glossar1/g/functionpdefn.htm] 'prototyping' [/link] ), Python requires all functions to be defined before they are called.
In order to access the value which is returned by the function, we must store it in a variable. Let's call it 'feedinfo'. The way we assign the output to 'feedinfo' is to call the function as the assignment value.
feedinfo = getlistinfo("dat")
When we implement another data list, we can call the same function, assigning it to a different variable and changing the argument accordingly.
In the next tutorial, we will develop the class for the feed.
- This is NOT the Beginning
- Python Best Practice: the Bang Line
- The Tasks This Python Program Must Do
- Holding the User Data in Python With CGI
- Holding the User Data in Python With PHP
- Defining the First Python Function
- Reading the RSS Feed as a Python File Object
- Using a Python Iterator
- Calling Python's Function, Retrieving the Feed Address
<< Previous | Next

