How to pretty-print cyclic dictionaries?

2010-04-29 Thread Dietrich Bollmann
Hi, I would like to represent graphs as cyclic dictionaries in Python. The python code for the graphs is generated by some other program (written in lisp) and I wonder what would be the best syntax for writing the cycles in Python? The following works: a = {} a['a'] = a As can be seen here:

Re: How to pretty-print cyclic dictionaries?

2010-04-29 Thread Dietrich Bollmann
Hi Chris and Garrick :) On Thu, 2010-04-29 at 18:09 +, Garrick P wrote: Chris Rebert clp2 at rebertia.com writes: ... If you want a prettier print, you could try serializing it to YAML and printing the result out; YAML has syntax for tags. Cheers, Chris --

Re: How to pretty-print cyclic dictionaries?

2010-04-29 Thread Dietrich Bollmann
Hi Robert, On Thu, 2010-04-29 at 11:56 -0500, Robert Kern wrote: On 4/29/10 11:23 AM, Dietrich Bollmann wrote: Hi, I would like to represent graphs as cyclic dictionaries in Python. The python code for the graphs is generated by some other program (written in lisp) and I wonder what

How to convert between Japanese coding systems?

2009-02-18 Thread Dietrich Bollmann
, to) from = contentType to = 'utf-8' contentUtf8 = convertCodingSystem(decodeBase64(content), from, to) The only problem is that I could not find any standard functionality to convert between different Japanese coding systems. Thanks, Dietrich Bollmann -- http://mail.python.org/mailman/listinfo

Re: How to write a simple shell loop in python?

2009-01-23 Thread Dietrich Bollmann
: There is a little tutorial for cmd.Cmd here: - http://www.doughellmann.com/PyMOTW/cmd/index.html The documentation is here: - http://docs.python.org/library/cmd.html (got it from Ben Finney's post) On Wed, 2009-01-21 at 08:37 -0500, Steve Holden wrote: Dietrich Bollmann wrote: Hi, I am

How to write a simple shell loop in python?

2009-01-20 Thread Dietrich Bollmann
Hi, I am trying to write a simple shell loop in Python. My simple approach works fine - but the first output line after entering something is always indented by one blank. Is there any logic explanation for this? How can I get rid of the blank? Is there a smarter way to write a simple shell

Re: Error in Extending/Embedding FAQ, point 16: How do I tell incomplete input from invalid input?

2008-04-23 Thread Dietrich Bollmann
+0900, Dietrich Bollmann wrote: On Wed, 2008-04-23 at 00:12 +0900, Dietrich Bollmann wrote: The following code for example: eins = [1, ... 2, ... 3] is accepted without any problem by the Python shell. When using the code from the FAQ and entering it line

Error in Extending/Embedding FAQ, point 16: How do I tell incomplete input from invalid input?

2008-04-22 Thread Dietrich Bollmann
Hi, Both code examples from paragraph 16 from the Python Extending / Embedding FAQ - 'How do I tell incomplete input from invalid input?' - ( http://www.python.org/doc/faq/extending/#how-do-i-tell-incomplete-input-from-invalid-input ) do not work with the current state of Python anymore. In

Re: Error in Extending/Embedding FAQ, point 16: How do I tell incomplete input from invalid input?

2008-04-22 Thread Dietrich Bollmann
On Wed, 2008-04-23 at 00:12 +0900, Dietrich Bollmann wrote: The following code for example: eins = [1, ... 2, ... 3] is accepted without any problem by the Python shell. When using the code from the FAQ and entering it line by line already the second line causes

Re: segmentation fault when executing PyImport_ImportModule(sys)

2008-04-12 Thread Dietrich Bollmann
Hi, I found the reason for the segmentation fault and hope that my solution might be helpful for somebody else some day :) On Tue, 2008-04-08 at 19:31 +0900, Dietrich Bollmann wrote: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb046ab90 (LWP 9854

segmentation fault when executing PyImport_ImportModule(sys)

2008-04-08 Thread Dietrich Bollmann
Hi, Since some time I get the following segmentation fault in an application which used to work fine until recently. I made a backtrace but couldn't find the reason for the segmentaion fault until now. In the hope that somebody might have encountered a similar problem or does understand the

segmentation fault when executing PyImport_ImportModule(sys)

2008-04-08 Thread Dietrich Bollmann
Hi, Since some time I get the following segmentation fault in an application which used to work fine until recently. I made a backtrace but couldn't find the reason for the segmentaion fault until now. In the hope that somebody might have encountered a similar problem or does understand the