tags:

views:

160

answers:

2

hey i started learning python and am quite confused as how the google data library works. google has a pizza party example over at this link

can anyone here please take the time to explain how it is being done. i would be so grateful.

WHAT I UNDERSTAND:

<entry xmlns='http://www.w3.org/2005/Atom' xmlns:p='http://example.com/pizza/1.0'&gt;
  <id>http://www.example.com/pizzaparty/223&lt;/id&gt;
  <title type='text'>Pizza at my house!</title>
  <author>
    <name>Joe</name>
    <email>[email protected]</email>
  </author>
  <content type='text'>
    Join us for a fun filled evening of pizza and games!
  </content>
  <link rel='alternate' type='text/html'
        href='http://www.example.com/joe_user/pizza_at_my_house.html'/&gt;
  <p:pizza toppings='pepperoni, sausage' size='large'>Pepperoni with cheese and 
sausage</p:pizza>
  <p:pizza toppings='mushrooms' size='medium'>Mushroom</p:pizza>
  <p:pizza toppings='ham, pineapple' size='extra large'>Hawaiian</p:pizza>
  <p:capacity>25</p:capacity>
  <p:location>My place.<p:address>123 Imaginary Ln, Sometown MO 63000</p:address></p:location>
</entry>

this is the XML feed for the pizza. why it is created i do not understand.

NOW this is the linking to the XML feed:

import atom.core

PIZZA_TEMPLATE = '{http://example.com/pizza/1.0}%s'

class Capacity(atom.core.XmlElement):
  _qname = PIZZA_TEMPLATE % 'capacity'

in PIZZA_TEMPLATE, what is "%s"? what is atom.core?

i am a little confused. please help me.

+2  A: 

%s is a string placeholder, and % is the string interpolation operator. See the Python docs on string formatting for more information.

atom.core is a Python module to work with Atom feeds.

Jon Skeet
A: 

Given that this question is about Python and involves a pizza party, I'd say you were biting off more than you can chew ...

But seriously, if you're just learning Python, start with something simpler.

pavium