Zopeのprintedって輩のこと

ヘルプを眺めてたらprintedについて書いてあるのを発見した。

サンプルスクリプトの最後には「return printed」と書いてあって、こりゃなんだー、と思ってたところだったのだ。「print」ってのはプログラムでよく見るけど、「printed」はあんまり見ないからなぁ。

Because the "print" statement cannot operate normally in Zope, its effect has been changed.

で、結局、

The special builtin name "printed" evaluates to the concatenation of all text printed so far during the current execution of the script.

ということらしい。要するに、いろいろprintしたものをつないでそいつら全部をまとめちゃうわけね。ということは、

print "このスクリプトのタイトルは"
print script.title
print "なんですよ。マジで。"
return printed

なんてふうにすれば…


060127-1

となるのか。「つなぐ」といってもインライン要素みたいにつなぐわけじゃないのね…。

カテゴリ
Python Python
トラックバック用URL:
http://nagosui.org:8080/Nagosui/COREBlog2/learning-python-zope-printed/tbping
コメントを追加

下のフォームに記入してコメントを追加できます。平文テキスト形式。

(必須)
(必須)
(必須)
(Required)
Enter the word

このBlogについて
Plone, Zope, Pythonなどのトピックについてのメモです。
カテゴリ
Plone (98)
Plone Products (23)
COREBlog2 (31)
COREBlog1 (29)
ReadingCOREBlog (7)
Zope (66)
Turbogears (18)
Django (12)
Python (25)
Linux (30)
Nagosui (12)
Design (33)
Misc (48)
moblog (5)
最近のエントリ
浜松ブラスバンド定期演奏会2008 nyusuke 2008年11月24日
Glossy Horizontal Menuを使う nyusuke 2008年11月17日
第3回Python東海終了 nyusuke 2008年11月17日
Universalじゃない件 nyusuke 2008年11月15日
最近のコメント
Re:WebデザイナーのためのDjangoはじめの一歩 nyusuke 2007年06月01日
Re:WebデザイナーのためのDjangoはじめの一歩 pateo 2007年05月31日
Re:東海Python Workshop 01終了 nyusuke 2007年05月31日
Re:東海Python Workshop 01終了 kfuruhata 2007年05月30日