Inheritance in nested classes
I'm experimenting with using Python for a small web interface, using Mark Hammond's nice win32 extensions. I use a small class hierarchy which uses inheritance and nested classes. Here are a small extract of the code: class page: def __init__(self): self.head=[] def __str__(self): ... class simple_tag: ... class p(simple_tag): ... class table: ... class row: ... class data: ... ... Will this type of code perform noticable slower than unnested classes? I'm using the Active Server Pages integration in the win32 extensions, does anyone have good/bad experiences using this interface? Thanks. /Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Encoding problem with web application (Paste+Mako)
Rob Wolfe wrote: > > You have to know the encoding of user input and then you > can use ``input_encoding`` and ``output_encoding`` parameters > of ``Template``. Mako internally handles everything as Python unicode > objects. > For example: > > t = Template(filename="templ.mako", input_encoding="iso-8859-2", > output_encoding="iso-8859-2") > content = t.render(**context) > > -- > HTH, > Rob > Thanks Rob Using: t=Template(content,input_encoding="utf-8", output_encoding="utf-8") did the trick. Thanks for the help. /Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Internationalised email subjects
From: http://docs.python.org/lib/module-email.header.html >>> from email.message import Message >>> from email.header import Header >>> msg = Message() >>> h = Header('p\xf6stal', 'iso-8859-1') >>> msg['Subject'] = h >>> print msg.as_string() Subject: =?iso-8859-1?q?p=F6stal?= /Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: python website
The Daily Python-URL http://www.pythonware.com/daily/ -- http://mail.python.org/mailman/listinfo/python-list
Re: text-mode tree viewer?
Not quite, but almost: data=[["Peter", ["Ian", [["Randy", ["Clara"], "Paul", ["Mary", ["Arthur"]]] def show(data,level): for i in data: if i.__class__.__name__=='list': show(i,level+1) else: print '%s->%s' % ('-'*level,i) show(data,0) /Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: text-mode tree viewer?
Torsten Bronger wrote: > > It doesn't show Paul and Mary on the same level. I (think I) solved > the problem with this: > I could do so if Poul was in a list of his own, like "Arthur" and "Clara". /Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Executing other python code
Over-simplified yes, but it will work! Python is beautiful :-) -- http://mail.python.org/mailman/listinfo/python-list