what does this mean?
Mike C. Fletcher
mcfletch at rogers.com
Wed May 19 13:11:38 EDT 2004
mr. ice wrote:
>I am new to python, The following statement is in the beginning of
>class definition in a python scripts, what does it mean? Help?
>class %(class_)s_W : public XMsg_W
>{
>
>
You will likely notice that there are "" or '' marks around the text
you're reading there. It looks a lot like a string template that
someone is using to create C++ code. A string like this "Hello
%(name)s_xyz" gets expanded in Python like so:
name = 'this'
value = "Hello %(name)s_xyz" % locals()
yielding:
value == "Hello this_xyz"
So whoever coded the module is likely trying to auto-generate some C++
code using Python string substitution.
HTH,
Mike
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/
blog: http://zope.vex.net/~mcfletch/plumbing/
More information about the Python-list
mailing list